Skip to content

Commit

Permalink
fix: backend connects on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronm-2112 committed Dec 13, 2023
1 parent faa37ae commit 013dc33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
3 changes: 1 addition & 2 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ asarUnpack:
- resources/**
win:
icon: 'app-icon/win/icon.ico'
executableName: react
executableName: SODA for SPARC
extraResources:
- from: ./file_templates
to: ./file_templates
- from: ./pyflaskdist/app.exe
to: ./pyflaskdist/app.exe
asar: true
target:
- nsis
Expand Down
25 changes: 6 additions & 19 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,24 +224,11 @@ let updatechecked = false;
* @returns {boolean} True if the app is packaged, false if it is running from a dev version.
*/
const guessPackaged = () => {
const windowsPath = join(__dirname, "..", PY_FLASK_DIST_FOLDER);
ElectronLog.info("Windows path: " + windowsPath);
const unixPath = join(process.resourcesPath, PY_FLASK_MODULE);
if (process.platform === "darwin" || process.platform === "linux") {
if (existsSync(unixPath)) {
return true;
} else {
return false;
}
}
if (process.platform === "win32") {
if (existsSync(windowsPath)) {
ElectronLog.info("App is packaged returning true [ Windows ]")

return true;
} else {
return false;
}
const executablePath = join(process.resourcesPath, PY_FLASK_MODULE);
if (existsSync(executablePath)) {
return true;
} else {
return false;
}
};

Expand All @@ -258,7 +245,7 @@ const getScriptPath = () => {
return join(__dirname, "..", PY_FLASK_FOLDER, PY_FLASK_MODULE + ".py");
}
if (process.platform === "win32") {
const winPath = join(__dirname, PY_FLASK_DIST_FOLDER, PY_FLASK_MODULE + ".exe");
const winPath = join(process.resourcesPath, PY_FLASK_MODULE + ".exe");
ElectronLog.info("App is packaged [Windows]; Path to server executable: " + winPath);
return winPath;
} else {
Expand Down

0 comments on commit 013dc33

Please sign in to comment.