beep boop

This commit is contained in:
Erick Zhao
2024-06-12 20:34:54 -07:00
parent e6d2697cbc
commit ed1efe60a0
10 changed files with 76 additions and 21 deletions

View File

@@ -0,0 +1,28 @@
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.asar
const appPath = app.getAppPath();
const asarFile = `app-${platform}.asar`;
// Maybe we'll handle this in Electron one day
if (path.basename(appPath) === 'app.asar') {
const platformAppPath = path.join(path.dirname(appPath), asarFile);
// This is an undocumented API. It exists.
app.setAppPath(platformAppPath);
}
const require = createRequire(import.meta.url);
process._archPath = require.resolve(`../${asarFile}`);
await import(process._archPath);
}

View File

@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.esm.json",
"compilerOptions": {
"module": "ESNext",
"target":"ESNext",
"outDir": ".",
},
"include": [
".",
"../ambient.d.ts"
],
"exclude": []
}