Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 (electron) improved OS detection #1658

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-*'",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tiny dev-experience improvement.

"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;
6 changes: 6 additions & 0 deletions upcoming-release-notes/1658.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MatissJanis]
---

Electron: improving operating system detection