mirror of
https://github.com/archlinux/aur.git
synced 2026-02-10 06:54:23 +01:00
26 lines
No EOL
1,008 B
JavaScript
26 lines
No EOL
1,008 B
JavaScript
#!/usr/bin/@ELECTRON@
|
|
// don't edit the electron binary name here! simply change the variable in the PKGBUILD and we will sed it into the correct one :)
|
|
import { app } from "electron/main";
|
|
import * as path from "node:path";
|
|
import * as fs from "node:fs";
|
|
const name = "qoder";
|
|
// Change command name.
|
|
const fd = fs.openSync("/proc/self/comm", fs.constants.O_WRONLY);
|
|
fs.writeSync(fd, name);
|
|
fs.closeSync(fd);
|
|
// Remove all extra prefix arguments
|
|
process.argv.splice(
|
|
0,
|
|
process.argv.findIndex((arg) => arg.endsWith("/qoder.js")),
|
|
);
|
|
// Set application paths.
|
|
const appPath = import.meta.dirname;
|
|
const packageJson = JSON.parse(fs.readFileSync(new URL("./package.json", import.meta.url)));
|
|
app.setAppPath(appPath);
|
|
app.setDesktopName(name + ".desktop");
|
|
app.setName(name);
|
|
app.setPath("userCache", path.join(app.getPath("cache"), name));
|
|
app.setPath("userData", path.join(app.getPath("appData"), name));
|
|
app.setVersion(packageJson.version);
|
|
// Run the application.
|
|
await import(appPath + "/out/main.js"); |