mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Merge pull request #628 from CocoTheOwner/reopenVSCodeOnFail
Try opening VSCode again after first time failed
This commit is contained in:
commit
c2779570fa
@ -175,6 +175,30 @@ public class IrisProject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File f = d.getLoader().getDataFolder();
|
File f = d.getLoader().getDataFolder();
|
||||||
|
|
||||||
|
if (!doOpenVSCode(f)) {
|
||||||
|
File ff = new File(d.getLoader().getDataFolder(), d.getLoadKey() + ".code-workspace");
|
||||||
|
Iris.warn("Project missing code-workspace: " + ff.getAbsolutePath() + " Re-creating code workspace.");
|
||||||
|
|
||||||
|
try {
|
||||||
|
IO.writeAll(ff, createCodeWorkspaceConfig());
|
||||||
|
} catch (IOException e1) {
|
||||||
|
Iris.reportError(e1);
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
updateWorkspace();
|
||||||
|
if (!doOpenVSCode(f)){
|
||||||
|
Iris.warn("Tried creating code workspace but failed a second time. Your project is likely corrupt.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean doOpenVSCode(File f) throws IOException {
|
||||||
boolean foundWork = false;
|
boolean foundWork = false;
|
||||||
for (File i : Objects.requireNonNull(f.listFiles())) {
|
for (File i : Objects.requireNonNull(f.listFiles())) {
|
||||||
if (i.getName().endsWith(".code-workspace")) {
|
if (i.getName().endsWith(".code-workspace")) {
|
||||||
@ -195,24 +219,7 @@ public class IrisProject {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return foundWork;
|
||||||
if (!foundWork) {
|
|
||||||
File ff = new File(d.getLoader().getDataFolder(), d.getLoadKey() + ".code-workspace");
|
|
||||||
Iris.warn("Project missing code-workspace: " + ff.getAbsolutePath() + " Re-creating code workspace.");
|
|
||||||
|
|
||||||
try {
|
|
||||||
IO.writeAll(ff, createCodeWorkspaceConfig());
|
|
||||||
} catch (IOException e1) {
|
|
||||||
Iris.reportError(e1);
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
updateWorkspace();
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(VolmitSender sender, long seed, Consumer<World> onDone) throws IrisException {
|
public void open(VolmitSender sender, long seed, Consumer<World> onDone) throws IrisException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user