File tree Expand file tree Collapse file tree
main/java/de/peeeq/wurstio/languageserver
test/java/tests/wurstscript/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,9 +136,8 @@ public boolean shouldCopyRunMapToWarcraftMapDir(Optional<GameVersion> detectedVe
136136 }
137137
138138 public boolean shouldUseInstallDirForMaps (Optional <GameVersion > detectedVersion ) {
139- return detectedVersion
140- .map (version -> version .compareTo (new GameVersion ("1.27.9" )) <= 0 )
141- .orElse (wc3PatchOrReforged () == Wc3Patch .PRE_129 );
139+ return detectedVersion .orElseGet (this ::fallbackGameVersion )
140+ .compareTo (new GameVersion ("1.27.9" )) <= 0 ;
142141 }
143142
144143 private static String stripComment (String line ) {
Original file line number Diff line number Diff line change @@ -35,6 +35,22 @@ public void readsScriptModeAndPatchFromWurstBuild() throws Exception {
3535 assertEquals (config .fallbackGameVersion (), new GameVersion ("1.28" ));
3636 assertTrue (config .shouldUseClassicWindowArg (Optional .empty ()));
3737 assertFalse (config .shouldUseReforgedLaunchArgs (Optional .empty ()));
38+ assertFalse (config .shouldUseInstallDirForMaps (Optional .empty ()));
39+ }
40+
41+ @ Test
42+ public void installDirMapPathIsOnlyForDetected127OrLower () throws Exception {
43+ Path project = Files .createTempDirectory ("wurst-build-config-map-path" );
44+ Files .writeString (project .resolve ("wurst.build" ), """
45+ projectName: Test
46+ wc3Patch: pre1.29
47+ """ );
48+
49+ WurstBuildConfig config = WurstBuildConfig .fromWorkspaceRoot (WFile .create (project .toFile ()));
50+
51+ assertTrue (config .shouldUseInstallDirForMaps (Optional .of (new GameVersion ("1.27" ))));
52+ assertFalse (config .shouldUseInstallDirForMaps (Optional .of (new GameVersion ("1.28" ))));
53+ assertFalse (config .shouldUseInstallDirForMaps (Optional .empty ()));
3854 }
3955
4056 @ Test
You can’t perform that action at this time.
0 commit comments