Skip to content

Commit 8551701

Browse files
committed
copy map on runmap if mapDocumentPath present
1 parent 89f5a71 commit 8551701

File tree

1 file changed

+9
-1
lines changed
  • de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
import java.io.File;
2626
import java.io.FileNotFoundException;
2727
import java.io.IOException;
28+
import java.nio.file.CopyOption;
2829
import java.nio.file.Path;
2930
import java.nio.file.Paths;
31+
import java.nio.file.StandardCopyOption;
3032
import java.time.Duration;
3133
import java.util.Arrays;
3234
import java.util.List;
@@ -130,7 +132,13 @@ private void startGame(WurstGui gui, CompilationResult result) throws Exception
130132
gui.sendProgress("Starting Warcraft 3...");
131133

132134
File mapCopy = cachedMapFile.get();
133-
if (w3data.getWc3PatchVersion().isPresent()) {
135+
136+
String mapDocumentPath = langServer.getConfigProvider().getConfig("mapDocumentPath", "");
137+
if (!mapDocumentPath.isEmpty()) {
138+
Path path = Paths.get(mapDocumentPath);
139+
mapCopy = path.toFile();
140+
java.nio.file.Files.copy(cachedMapFile.get().toPath(), path, StandardCopyOption.REPLACE_EXISTING);
141+
} else if (w3data.getWc3PatchVersion().isPresent()) {
134142
GameVersion gameVersion = w3data.getWc3PatchVersion().get();
135143
if (gameVersion.compareTo(GameVersion.VERSION_1_32) < 0) {
136144
mapCopy = copyToWarcraftMapDir(cachedMapFile.get());

0 commit comments

Comments
 (0)