summarylogtreecommitdiffstats
path: root/freezer-electron.js
diff options
context:
space:
mode:
Diffstat (limited to 'freezer-electron.js')
-rw-r--r--freezer-electron.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/freezer-electron.js b/freezer-electron.js
new file mode 100644
index 000000000000..7964d3b8f7a8
--- /dev/null
+++ b/freezer-electron.js
@@ -0,0 +1,28 @@
+#!/usr/bin/@ELECTRON@
+
+const name = 'freezer-electron';
+
+const {app} = require('electron');
+const fs = require('fs');
+const path = require('path');
+
+// 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 = path.join(path.dirname(__dirname), 'lib', name);
+const productName = 'Freezer';
+app.setAppPath(appPath);
+app.setDesktopName(name + '.desktop');
+app.setName(productName);
+app.setPath('userCache', path.join(app.getPath('cache'), productName));
+app.setPath('userData', path.join(app.getPath('appData'), productName));
+app.setVersion('@VERSION@');
+
+// Run the application
+require('module')._load(appPath, module, true);