-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { app } from 'electron'; | ||
import { createRequire } from 'node:module'; | ||
import path from 'node:path'; | ||
|
||
if (process.arch === 'arm64') { | ||
await setPaths('arm64'); | ||
} else { | ||
await setPaths('x64'); | ||
} | ||
|
||
async function setPaths(platform: string) { | ||
// This should return the full path, ending in something like | ||
// Notion.app/Contents/Resources/app | ||
const appPath = app.getAppPath(); | ||
const appFolder = `app-${platform}`; | ||
|
||
// Maybe we'll handle this in Electron one day | ||
if (path.basename(appPath) === 'app') { | ||
const platformAppPath = path.join(path.dirname(appPath), appFolder); | ||
|
||
// This is an undocumented private API. It exists. | ||
app.setAppPath(platformAppPath); | ||
} | ||
|
||
const require = createRequire(import.meta.url); | ||
process._archPath = require.resolve(`../${appFolder}`); | ||
|
||
await import(process._archPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters