Commit 10b75b3c authored by NicolaiO's avatar NicolaiO 🐼 Committed by TIGERs GitLab
Browse files

Resolve "Enable recordings in run-simulation pipeline"

Closes #1699

See merge request main/Sumatra!1469

sumatra-commit: fd7e8ff8537a59fdfa936a5271bdd8201198ac27
parent 115527c1
Pipeline #17241 passed with stage
in 3 minutes and 49 seconds
......@@ -28,8 +28,8 @@ import java.util.concurrent.TimeUnit;
public class SslGameControllerProcess implements Runnable
{
private static final String BINARY_NAME = "ssl-game-controller";
private static final Path TEMP_DIR = Paths.get("temp");
private static final File BINARY_FILE = TEMP_DIR.resolve(BINARY_NAME).toFile();
private static final Path BINARY_DIR = Paths.get("data");
private static final File BINARY_FILE = BINARY_DIR.resolve(BINARY_NAME).toFile();
@Getter
private final int gcUiPort;
......@@ -120,16 +120,23 @@ public class SslGameControllerProcess implements Runnable
private boolean setupBinary()
{
if (BINARY_FILE.exists() && !BINARY_FILE.delete())
if (BINARY_FILE.exists())
{
log.warn("Could not delete existing binary file: {}", BINARY_FILE);
return false;
try
{
Files.delete(BINARY_FILE.toPath());
} catch (IOException e)
{
log.warn("Could not delete existing binary: {}", BINARY_FILE, e);
return false;
}
}
File tmpDir = TEMP_DIR.toFile();
if (tmpDir.mkdirs())
File binaryDir = BINARY_DIR.toFile();
if (binaryDir.mkdirs())
{
log.debug("Temp dir created: {}", tmpDir);
tmpDir.deleteOnExit();
log.info("Binary dir created: {}", binaryDir);
}
if (!writeResourceToFile(BINARY_NAME, BINARY_FILE))
{
......@@ -138,7 +145,7 @@ public class SslGameControllerProcess implements Runnable
BINARY_FILE.deleteOnExit();
if (!BINARY_FILE.canExecute() && !BINARY_FILE.setExecutable(true))
{
log.warn("Binary is not executable and could not be made executable.");
log.warn("Binary is not executable and could not be made executable: {}", BINARY_FILE);
return false;
}
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment