fix json project & workspace file paths when migrating from binary

This commit is contained in:
OMGeeky
2025-07-17 20:10:32 +02:00
parent 7b7218ad4e
commit af48341439
2 changed files with 6 additions and 3 deletions

View File

@@ -241,9 +241,9 @@ public class Project implements ProjectTreeNode, Serializable, JsonSerializable
return null; return null;
} else { } else {
p = (Project) SettingsSave.loadInstance(f, "Project"); p = (Project) SettingsSave.loadInstance(f, "Project");
p.baseFolder = projRoot;
} }
p.save(); p.save();
} }
p.refreshTransients(w); p.refreshTransients(w);
return p; return p;

View File

@@ -115,7 +115,7 @@ public class Workspace implements ProjectTreeNode, Serializable, JsonSerializabl
w = loadWorkspaceFromJson(workspaceRoot, f2); w = loadWorkspaceFromJson(workspaceRoot, f2);
w.refreshTransients(); w.refreshTransients();
} else { } else {
Notification.addInfo("Could not find json workspace file. Falling back to binary"); Notification.addInfo("Could not find json workspace file. Checking for binary file");
File f = new File(workspaceRoot, WS_SETTINGS_FILE); File f = new File(workspaceRoot, WS_SETTINGS_FILE);
if (!workspaceRoot.exists() || !f.exists()) { if (!workspaceRoot.exists() || !f.exists()) {
w = new Workspace(workspaceRoot); w = new Workspace(workspaceRoot);
@@ -123,10 +123,13 @@ public class Workspace implements ProjectTreeNode, Serializable, JsonSerializabl
w = (Workspace) SettingsSave.loadInstance(f, "Workspace"); w = (Workspace) SettingsSave.loadInstance(f, "Workspace");
if (w == null) { if (w == null) {
w = new Workspace(workspaceRoot); w = new Workspace(workspaceRoot);
w.save();
} else { } else {
w.settingsFile = f2;
w.baseFolder = workspaceRoot;
Notification.addInfo("Switched workspace to json format.");
w.refreshTransients(); w.refreshTransients();
} }
w.save();
} }
} }
activeWorkspace = w; activeWorkspace = w;