diff options
author | Aaron McDaniel | 2018-10-23 16:53:17 -0500 |
---|---|---|
committer | Aaron McDaniel | 2018-10-23 16:53:17 -0500 |
commit | acbcdd821bdd0078e992483fcf83c40c708adaad (patch) | |
tree | bcc0ff89b3b5f0585f2d2ff3a09061196a6a7aeb /atom.js | |
parent | 77954060fd3775c2f28c2ba47a076f18f94ce99a (diff) | |
download | aur-acbcdd821bdd0078e992483fcf83c40c708adaad.tar.gz |
Updated with arch community fixes by Nicola
Diffstat (limited to 'atom.js')
-rw-r--r-- | atom.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/atom.js b/atom.js new file mode 100644 index 000000000000..386929835763 --- /dev/null +++ b/atom.js @@ -0,0 +1,33 @@ +#!/usr/bin/electron + +const name = "atom"; + +const {app} = require("electron"); +const fs = require("fs"); +const Module = require("module"); +const {join} = require("path"); +const vm = require("vm"); + +// Change command name. +const fd = fs.openSync("/proc/self/comm", fs.constants.O_WRONLY); +fs.writeSync(fd, name); +fs.closeSync(fd); + +// Remove first command line argument (/usr/bin/electron). +process.argv.splice(0, 1); + +// Set application paths. +const appPath = __dirname; +const packageJson = require(join(appPath, "package.json")); +const productName = packageJson.productName; +app.setAppPath(appPath); +app.setDesktopName(name + ".desktop"); +app.setName(productName); +app.setPath("userCache", join(app.getPath("cache"), productName)); +app.setPath("userData", join(app.getPath("appData"), productName)); +app.setVersion(packageJson.version); + +// Run the application. +const startupJs = fs.readFileSync(join(appPath, "startup.js"), "utf-8"); +vm.runInThisContext(startupJs); +Module._load(appPath, Module, true); |