Skip to content

Commit

Permalink
Fix fa_path.lua location
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackYps committed Mar 16, 2023
1 parent a641a6a commit a99ff28
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/com/faforever/client/patch/GameUpdaterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public CompletableFuture<Void> update(FeaturedModBean featuredMod, Set<String> s
return featuredModUpdateFuture
.thenAccept(patchResult -> {
try {
createFaPathLuaFile();
createFaPathLuaFile(useReplayFolder);
copyInitFile(patchResult.getInitFile());
} catch (IOException e) {
throw new CompletionException(e);
Expand All @@ -114,7 +114,7 @@ public CompletableFuture<Void> update(FeaturedModBean featuredMod, Set<String> s
});
}

private void createFaPathLuaFile() throws IOException {
private void createFaPathLuaFile(boolean useReplayFolder) throws IOException {
String installationPath = forgedAlliancePrefs.getInstallationPath().toString().replace("\\", "/");
String vaultPath = forgedAlliancePrefs.getVaultBaseDirectory().toString().replace("\\", "/");
String pathFileFormat = """
Expand All @@ -125,7 +125,13 @@ private void createFaPathLuaFile() throws IOException {
ClientVersion = "%s"
""".stripIndent();
String content = String.format(pathFileFormat, installationPath, vaultPath, gameType, gameVersion.toString(), Version.getCurrentVersion());
Files.writeString(dataPrefs.getBaseDataDirectory().resolve("fa_path.lua"), content);
Path baseDirectory;
if (useReplayFolder) {
baseDirectory = dataPrefs.getReplaysDirectory();
} else {
baseDirectory = dataPrefs.getBaseDataDirectory();
}
Files.writeString(baseDirectory.resolve("fa_path.lua"), content);
}

private void copyInitFile(Path initFile) throws IOException {
Expand Down

0 comments on commit a99ff28

Please sign in to comment.