Skip to content

Commit

Permalink
Uid not found in folder with space (#1625)
Browse files Browse the repository at this point in the history
Also sets the executable flag when downloading the uid executable.
Fixes #1624
  • Loading branch information
1-alex98 committed Mar 22, 2020
1 parent d23b272 commit 5044e85
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ task downloadUnixUid(type: Download) {
src "https://github.com/FAForever/uid/releases/download/v${faf_uid_version}/faf-uid"
dest file("${buildDir}/resources/native/faf-uid")
onlyIfNewer true
doLast {
file("${buildDir}/resources/native/faf-uid").setExecutable(true, false)
}
}

task downloadWindowsUid(type: Download) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package com.faforever.client.legacy;

import com.faforever.client.os.OsUtils;
import com.google.common.collect.Sets;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;


@Lazy
Expand All @@ -22,6 +19,6 @@ public class PosixUidService implements UidService {
public String generate(String sessionId, Path logFile) throws IOException {
String uidDir = System.getProperty("nativeDir", "lib");
Path uidPath = Paths.get(uidDir).resolve("faf-uid");
return OsUtils.execAndGetOutput(String.format("%s %s", uidPath.toAbsolutePath(), sessionId));
return OsUtils.execAndGetOutput(uidPath.toAbsolutePath().toString(), sessionId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class WindowsUidService implements UidService {
@Override
public String generate(String sessionId, Path logFile) throws IOException {
String uidDir = System.getProperty("nativeDir", "lib");
return OsUtils.execAndGetOutput(String.format("%s/faf-uid.exe %s", uidDir, sessionId));
return OsUtils.execAndGetOutput(String.format("%s/faf-uid.exe", uidDir), sessionId);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/faforever/client/os/OsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private OsUtils() {
throw new AssertionError("Not instantiable");
}

public static String execAndGetOutput(String cmd) throws IOException {
public static String execAndGetOutput(String... cmd) throws IOException {
Scanner scanner = new Scanner(
Runtime.getRuntime().exec(cmd).getInputStream(), UTF_8.name()
).useDelimiter("\\A");
Expand Down

0 comments on commit 5044e85

Please sign in to comment.