summarylogtreecommitdiffstats
path: root/code.js
blob: e06d0a00066962638ef07458db1c55aa3d9293b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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 :)

const name = 'code-oss';

const app = require('electron').app;
const path = require('path');
const fs = require("fs");

// 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/lib/code/code.js). - We call the CLI file first
process.argv.splice(0, 1);

// Set application paths.
const appPath = __dirname;
const packageJson = require(path.join(appPath, 'package.json'));
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.
require('module')._load(appPath, module, true);