app: fix sidecar args in release mode

This commit is contained in:
Tyler Wilding 2022-04-19 01:34:37 -04:00
parent 50774be9cf
commit dbbd549863
No known key found for this signature in database
GPG key ID: A89403EB356ED106
2 changed files with 12 additions and 19 deletions

View file

@ -52,6 +52,7 @@ jobs:
- uses: tauri-apps/tauri-action@v0 - uses: tauri-apps/tauri-action@v0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
with: with:
tagName: v__VERSION__ tagName: v__VERSION__
releaseName: "OpenGOAL Launcher v__VERSION__" releaseName: "OpenGOAL Launcher v__VERSION__"

View file

@ -17,17 +17,18 @@ export class RequirementStatus {
static Checking = Symbol("checking"); static Checking = Symbol("checking");
} }
// TODO - is this set to `production` properly in release mode?
export function isInDebugMode() { export function isInDebugMode() {
return process.env.NODE_ENV === "development"; return process.env.NODE_ENV === "development";
} }
// TODO - this is kind of a total hack
let debugPath; let debugPath;
let sidecarOptions = {};
if (isInDebugMode()) { if (isInDebugMode()) {
// TODO - this is kind of a total hack
let path = await resourceDir(); let path = await resourceDir();
debugPath = path.split("launcher")[0].split("?\\")[1]; debugPath = path.split("launcher")[0].split("?\\")[1];
debugPath += "\\launcher\\bundle-test\\data"; debugPath += "\\launcher\\bundle-test\\data";
sidecarOptions = { cwd: "bin" };
} }
export async function isAVXSupported() { export async function isAVXSupported() {
@ -42,21 +43,18 @@ export async function isAVXSupported() {
} }
export async function isOpenGLVersionSupported(version) { export async function isOpenGLVersionSupported(version) {
// TODO - glewinfo not pre-compiled to work on linux yet!
if ((await os.platform()) === "darwin") { if ((await os.platform()) === "darwin") {
return RequirementStatus.Unknown; return RequirementStatus.Unknown;
} }
// Otherwise, query for the version // Otherwise, query for the version
let command = Command.sidecar("bin/glewinfo", ["-version", version], { let command = Command.sidecar("bin/glewinfo", ["-version", version], sidecarOptions);
cwd: "bin",
});
try { try {
let output = await command.execute(); let output = await command.execute();
if (output.code === 0) { if (output.code === 0) {
return RequirementStatus.Met; return RequirementStatus.Met;
} }
return RequirementStatus.Failed; return RequirementStatus.Failed;
} catch { } catch (e) {
return RequirementStatus.Failed; return RequirementStatus.Failed;
} }
} }
@ -71,15 +69,13 @@ export async function extractAndValidateISO(filePath) {
command = Command.sidecar( command = Command.sidecar(
"bin/extractor", "bin/extractor",
[filePath, "--extract", "--proj-path", debugPath], [filePath, "--extract", "--proj-path", debugPath],
{ cwd: "bin" } sidecarOptions
); );
} else { } else {
command = Command.sidecar( command = Command.sidecar(
"bin/extractor", "bin/extractor",
[filePath, "--extract", "--validate"], [filePath, "--extract", "--validate"],
{ sidecarOptions
cwd: "bin",
}
); );
} }
@ -96,12 +92,10 @@ export async function decompileGameData(filePath) {
command = Command.sidecar( command = Command.sidecar(
"bin/extractor", "bin/extractor",
[filePath, "--decompile", "--proj-path", debugPath], [filePath, "--decompile", "--proj-path", debugPath],
{ cwd: "bin" } sidecarOptions
); );
} else { } else {
command = Command.sidecar("bin/extractor", [filePath, "--decompile"], { command = Command.sidecar("bin/extractor", [filePath, "--decompile"], sidecarOptions);
cwd: "bin",
});
} }
return await command.execute(); return await command.execute();
@ -117,12 +111,10 @@ export async function compileGame(filePath) {
command = Command.sidecar( command = Command.sidecar(
"bin/extractor", "bin/extractor",
[filePath, "--compile", "--proj-path", debugPath], [filePath, "--compile", "--proj-path", debugPath],
{ cwd: "bin" } sidecarOptions
); );
} else { } else {
command = Command.sidecar("bin/extractor", [filePath, "--compile"], { command = Command.sidecar("bin/extractor", [filePath, "--compile"], sidecarOptions);
cwd: "bin",
});
} }
return await command.execute(); return await command.execute();