Browse Source

Check for existence of module patch asset directory before iterating it in `Patch::cleanAutosave()`.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
14a1834348
1 changed files with 12 additions and 10 deletions
  1. +12
    -10
      src/patch.cpp

+ 12
- 10
src/patch.cpp View File

@@ -179,17 +179,19 @@ void PatchManager::saveAutosave() {
void PatchManager::cleanAutosave() {
// Remove files and folders in the `autosave/modules` folder that doesn't match a module in the rack.
std::string modulesDir = system::join(asset::autosavePath, "modules");
for (const std::string& entry : system::getEntries(modulesDir)) {
try {
int64_t moduleId = std::stol(system::getFilename(entry));
// Ignore modules that exist in the rack
if (APP->engine->getModule(moduleId))
continue;
if (system::isDirectory(modulesDir)) {
for (const std::string& entry : system::getEntries(modulesDir)) {
try {
int64_t moduleId = std::stol(system::getFilename(entry));
// Ignore modules that exist in the rack
if (APP->engine->getModule(moduleId))
continue;
}
catch (std::invalid_argument& e) {
}
// Remove the entry.
system::removeRecursively(entry);
}
catch (std::invalid_argument& e) {
}
// Remove the entry.
system::removeRecursively(entry);
}
}



Loading…
Cancel
Save