|
|
@@ -219,7 +219,7 @@ void PatchManager::cleanAutosave() { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool isPatchLegacyPre2(std::string path) { |
|
|
|
static bool isPatchLegacyV1(std::string path) { |
|
|
|
FILE* f = std::fopen(path.c_str(), "rb"); |
|
|
|
if (!f) |
|
|
|
return false; |
|
|
@@ -239,7 +239,7 @@ void PatchManager::load(std::string path) { |
|
|
|
system::removeRecursively(asset::autosavePath); |
|
|
|
system::createDirectories(asset::autosavePath); |
|
|
|
|
|
|
|
if (isPatchLegacyPre2(path)) { |
|
|
|
if (isPatchLegacyV1(path)) { |
|
|
|
// Copy the .vcv file directly to "patch.json". |
|
|
|
system::copy(path, system::join(asset::autosavePath, "patch.json")); |
|
|
|
} |
|
|
@@ -425,7 +425,6 @@ json_t* PatchManager::toJson() { |
|
|
|
|
|
|
|
void PatchManager::fromJson(json_t* rootJ) { |
|
|
|
clear(); |
|
|
|
legacy = 0; |
|
|
|
|
|
|
|
// version |
|
|
|
std::string version; |
|
|
@@ -436,18 +435,6 @@ void PatchManager::fromJson(json_t* rootJ) { |
|
|
|
INFO("Patch was made with Rack v%s, current Rack version is v%s", version.c_str(), APP_VERSION.c_str()); |
|
|
|
} |
|
|
|
|
|
|
|
// Detect old patches with ModuleWidget::params/inputs/outputs indices. |
|
|
|
if (string::startsWith(version, "0.3.") || string::startsWith(version, "0.4.") || string::startsWith(version, "0.5.") || version == "" || version == "dev") { |
|
|
|
// Use ModuleWidget::params/inputs/outputs indices instead of Module. |
|
|
|
legacy = 1; |
|
|
|
} |
|
|
|
else if (string::startsWith(version, "0.6.")) { |
|
|
|
legacy = 2; |
|
|
|
} |
|
|
|
if (legacy) { |
|
|
|
INFO("Loading patch using legacy mode %d", legacy); |
|
|
|
} |
|
|
|
|
|
|
|
// path |
|
|
|
json_t* pathJ = json_object_get(rootJ, "path"); |
|
|
|
if (pathJ) |
|
|
@@ -481,11 +468,6 @@ void PatchManager::fromJson(json_t* rootJ) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool PatchManager::isLegacy(int level) { |
|
|
|
return legacy && legacy <= level; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PatchManager::log(std::string msg) { |
|
|
|
warningLog += msg; |
|
|
|
warningLog += "\n"; |
|
|
|