Skip to content

Commit e3eaa6c

Browse files
authored
fix runmap with exe override (#1147)
1 parent 546446a commit e3eaa6c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public MapRequest(WurstLanguageServer langServer, Optional<File> map, List<Strin
101101
this.runArgs = new RunArgs(compileArgs);
102102
this.wc3Path = wc3Path;
103103
if (gameExePath.isPresent() && StringUtils.isNotBlank(gameExePath.get())) {
104-
this.w3data = new W3InstallationData(Optional.of(new File(gameExePath.get())), Optional.of(GameVersion.VERSION_1_29));
104+
this.w3data = new W3InstallationData(Optional.of(new File(gameExePath.get())), Optional.empty());
105105
} else {
106106
this.w3data = getBestW3InstallationData();
107107
}

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/utils/W3InstallationData.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ public W3InstallationData(Optional<File> gameExe, Optional<GameVersion> version)
3434
this.languageServer = null;
3535
this.gameExe = gameExe;
3636
this.version = version;
37+
if (!this.version.isPresent() && this.gameExe.isPresent()) {
38+
try {
39+
this.version = Optional.ofNullable(GameExe.getVersion(this.gameExe.get()));
40+
WLogger.info("Parsed game version from configured executable: " + this.version);
41+
} catch (IOException e) {
42+
WLogger.warning("Could not parse game version from configured executable", e);
43+
}
44+
}
3745
}
3846

3947
/** Evaluates the game path and version by discovering the system environment. */

0 commit comments

Comments
 (0)