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

Method save

src/patch.cpp:115–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114
115void Manager::save(std::string path) {
116 INFO("Saving patch %s", path.c_str());
117 // Dispatch SaveEvent to modules
118 APP->engine->prepareSave();
119
120 // Omit the patch path from the patch archive, so sharing their patch doesn't leak the user's home dir name, which is their OS username.
121 // Then restore it so it is saved to <Rack user dir>/autosave/patch.json on the next autosave.
122 std::string lastPath = this->path;
123 this->path = "";
124 DEFER({this->path = lastPath;});
125
126 // Save patch.json
127 saveAutosave();
128 // Clean up autosave directory (e.g. removed modules)
129 cleanAutosave();
130
131 // Take screenshot (disabled because there is currently no way to quickly view them on any OS or website.)
132 // APP->window->screenshot(system::join(autosavePath, "screenshot.png"));
133
134 double startTime = system::getTime();
135 // Set compression level to 1 so that a 500MB/s SSD is almost bottlenecked
136 system::archiveDirectory(path, autosavePath, 1);
137 double endTime = system::getTime();
138 INFO("Archived patch in %lf seconds", (endTime - startTime));
139}
140
141
142void Manager::saveDialog() {

Callers

nothing calls this directly

Calls 3

getTimeFunction · 0.85
archiveDirectoryFunction · 0.85
prepareSaveMethod · 0.80

Tested by

no test coverage detected