diff --git a/package.json b/package.json index b5b8542..fa37dea 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ ], "scripts": { "start": "webpack --mode production && electron .", + "pack-mac": "npm run build && electron-builder --mac --x64", "pack-windows": "npm run build && electron-builder --win --x64", "pack-windows:dev": "npm run build && electron-builder --dir --win --x64", "postinstall": "electron-builder install-app-deps", diff --git a/src/app.jsx b/src/app.jsx index 23e5f61..0d8b2ef 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -24,7 +24,18 @@ if (remote.process.argv.length >= 3) { } else if (isDev) { currentDirectory = path.resolve(app.getAppPath(), "dev-env"); } else { - currentDirectory = remote.process.env.PORTABLE_EXECUTABLE_DIR; + if (remote.process.env.PORTABLE_EXECUTABLE_DIR) { + currentDirectory = remote.process.env.PORTABLE_EXECUTABLE_DIR; + } else if (remote.process.env.INIT_CWD) { + currentDirectory = remote.process.env.INIT_CWD; + } else if (app.getPath("exe")) { + currentDirectory = path.dirname(app.getPath("exe")); + } else if (remote.process.execPath) { + currentDirectory = remote.process.execPath; + } +} +if (path.basename(currentDirectory) === "MacOS") { + currentDirectory = path.resolve(currentDirectory, "..", "..", ".."); } const Wrapper = styled.main` @@ -56,7 +67,6 @@ const Versus = styled.img` `; export default function App() { - if (!currentDirectory) { return (