mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Try opening VSCode again after first time failed
This commit is contained in:
parent
784fca98c8
commit
61d461eea5
@ -175,28 +175,8 @@ public class IrisProject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File f = d.getLoader().getDataFolder();
|
File f = d.getLoader().getDataFolder();
|
||||||
boolean foundWork = false;
|
|
||||||
for (File i : Objects.requireNonNull(f.listFiles())) {
|
|
||||||
if (i.getName().endsWith(".code-workspace")) {
|
|
||||||
foundWork = true;
|
|
||||||
J.a(() ->
|
|
||||||
{
|
|
||||||
updateWorkspace();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (IrisSettings.get().getStudio().isOpenVSCode()) {
|
if (!doOpenVSCode(f)) {
|
||||||
if (!GraphicsEnvironment.isHeadless()) {
|
|
||||||
Iris.msg("Opening VSCode. You may see the output from VSCode.");
|
|
||||||
Iris.msg("VSCode output always starts with: '(node:#####) electron'");
|
|
||||||
Desktop.getDesktop().open(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!foundWork) {
|
|
||||||
File ff = new File(d.getLoader().getDataFolder(), d.getLoadKey() + ".code-workspace");
|
File ff = new File(d.getLoader().getDataFolder(), d.getLoadKey() + ".code-workspace");
|
||||||
Iris.warn("Project missing code-workspace: " + ff.getAbsolutePath() + " Re-creating code workspace.");
|
Iris.warn("Project missing code-workspace: " + ff.getAbsolutePath() + " Re-creating code workspace.");
|
||||||
|
|
||||||
@ -207,6 +187,9 @@ public class IrisProject {
|
|||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
updateWorkspace();
|
updateWorkspace();
|
||||||
|
if (!doOpenVSCode(f)){
|
||||||
|
Iris.warn("Tried creating code workspace but failed a second time. Your project is likely corrupt.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
@ -215,6 +198,30 @@ public class IrisProject {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean doOpenVSCode(File f) throws IOException {
|
||||||
|
boolean foundWork = false;
|
||||||
|
for (File i : Objects.requireNonNull(f.listFiles())) {
|
||||||
|
if (i.getName().endsWith(".code-workspace")) {
|
||||||
|
foundWork = true;
|
||||||
|
J.a(() ->
|
||||||
|
{
|
||||||
|
updateWorkspace();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (IrisSettings.get().getStudio().isOpenVSCode()) {
|
||||||
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
|
Iris.msg("Opening VSCode. You may see the output from VSCode.");
|
||||||
|
Iris.msg("VSCode output always starts with: '(node:#####) electron'");
|
||||||
|
Desktop.getDesktop().open(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return foundWork;
|
||||||
|
}
|
||||||
|
|
||||||
public void open(VolmitSender sender, long seed, Consumer<World> onDone) throws IrisException {
|
public void open(VolmitSender sender, long seed, Consumer<World> onDone) throws IrisException {
|
||||||
if (isOpen()) {
|
if (isOpen()) {
|
||||||
close();
|
close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user