summarylogtreecommitdiffstats
path: root/atom.js
diff options
context:
space:
mode:
authorfrantic10482018-06-03 22:36:05 +0800
committerfrantic10482018-06-03 22:36:05 +0800
commit710e579d4db40869ff23b374a0b2d21b4811c5f7 (patch)
tree62e68febaa6c02873f7e6b4681189f5c0e0bacd2 /atom.js
downloadaur-710e579d4db40869ff23b374a0b2d21b4811c5f7.tar.gz
initial pkg, at version 1.27.1-1
replaces atom-editor-transparent 1.18.0-1
Diffstat (limited to 'atom.js')
-rw-r--r--atom.js33
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);