Skip to content

Commit

Permalink
🔧 (electron) improved OS detection
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Sep 5, 2023
1 parent 96863b3 commit 9a9bb38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"scripts": {
"start": "yarn start:browser",
"start:desktop": "npm-run-all --parallel 'start:desktop-*'",
"start:desktop": "yarn rebuild-electron && npm-run-all --parallel 'start:desktop-*'",
"start:desktop-node": "yarn workspace loot-core watch:node",
"start:desktop-client": "yarn workspace @actual-app/web watch",
"start:desktop-electron": "yarn workspace desktop-electron watch",
Expand Down
14 changes: 8 additions & 6 deletions packages/loot-core/src/client/platform.electron.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const isWindows =
navigator.platform && navigator.platform.toLowerCase() === 'win32';
const os = require('os');

const isMac =
navigator.platform && navigator.platform.toUpperCase().indexOf('MAC') >= 0;
const isWindows = os.platform() === 'win32';
const isMac = os.platform() === 'darwin';
const isLinux = os.platform() === 'linux';

export const isPlaywright = navigator.userAgent === 'playwright';
export const isPlaywright = false;

export const OS: 'windows' | 'mac' | 'linux' | 'unknown' = isWindows
? 'windows'
: isMac
? 'mac'
: 'linux';
: isLinux
? 'linux'
: 'unknown';
export const env: 'web' | 'mobile' | 'unknown' = 'unknown';
export const isBrowser = false;

0 comments on commit 9a9bb38

Please sign in to comment.