From 8de0cb56ccf529332bb2e08019516765137dc483 Mon Sep 17 00:00:00 2001 From: Ludea Date: Tue, 22 Oct 2024 12:15:08 +0000 Subject: [PATCH] fix: right extension on linux and macos platform --- src/components/Footer.tsx | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index b4c01dd4..af990ad4 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -118,31 +118,20 @@ function Footer() { }, [gameName, store, setGlobalError]); const spawn = () => { - let extension; - let shell: string; - let arg: string[]; - - switch (platform()) { - case "windows": - extension = ".exe"; - shell = "cmd"; - arg = ["/C"]; - break; - case "macos": - extension = ".app"; - shell = "sh"; - arg = ["-c"]; - break; - case "linux": - extension = ".sh"; - shell = "sh"; - arg = ["-c"]; - break; - default: - extension = ""; - shell = ""; - arg = [""]; - break; + let extension = ""; + let shell: string = ""; + let arg: string[] = [""]; + + const host = platform(); + + if (host === "windows") { + extension = ".exe"; + shell = "cmd"; + arg = ["/C"]; + } else if (host === "linux" || host === "macos") { + extension = ""; + shell = "sh"; + arg = ["-c"]; } const command = Command.create(shell, [