MCPcopy Create free account
hub / github.com/VCVRack/Rack / cleanAutosave

Method cleanAutosave

src/patch.cpp:265–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263
264
265void Manager::cleanAutosave() {
266 // Remove files and directories in the `autosave/modules` directory that doesn't match a module in the rack.
267 std::string modulesDir = system::join(autosavePath, "modules");
268 if (system::isDirectory(modulesDir)) {
269 for (const std::string& entry : system::getEntries(modulesDir)) {
270 try {
271 int64_t moduleId = std::stoll(system::getFilename(entry));
272 // Ignore modules that exist in the rack
273 if (APP->engine->getModule(moduleId))
274 continue;
275 }
276 catch (std::invalid_argument& e) {}
277 catch (std::out_of_range& e) {}
278 // Remove the entry.
279 system::removeRecursively(entry);
280 }
281 }
282}
283
284
285static bool isPatchLegacyV1(std::string path) {

Callers

nothing calls this directly

Calls 6

isDirectoryFunction · 0.85
getEntriesFunction · 0.85
getFilenameFunction · 0.85
removeRecursivelyFunction · 0.85
joinFunction · 0.70
getModuleMethod · 0.45

Tested by

no test coverage detected