提交 b1df68a4 编写于 作者: J Joao Moreno

pimp up env

上级 fd5c1c3c
...@@ -18,10 +18,6 @@ import platform = require('vs/base/common/platform'); ...@@ -18,10 +18,6 @@ import platform = require('vs/base/common/platform');
import uri from 'vs/base/common/uri'; import uri from 'vs/base/common/uri';
import types = require('vs/base/common/types'); import types = require('vs/base/common/types');
export interface IUpdateInfo {
baseUrl: string;
}
export interface IProductConfiguration { export interface IProductConfiguration {
nameShort: string; nameShort: string;
nameLong: string; nameLong: string;
...@@ -124,65 +120,44 @@ export interface ICommandLineArguments { ...@@ -124,65 +120,44 @@ export interface ICommandLineArguments {
debugBrkExtensionHost: boolean; debugBrkExtensionHost: boolean;
logExtensionHostCommunication: boolean; logExtensionHostCommunication: boolean;
disableExtensions: boolean; disableExtensions: boolean;
extensionsHomePath: string; extensionsHomePath: string;
extensionDevelopmentPath: string; extensionDevelopmentPath: string;
extensionTestsPath: string; extensionTestsPath: string;
programStart: number; programStart: number;
pathArguments?: string[]; pathArguments?: string[];
enablePerformance?: boolean; enablePerformance?: boolean;
firstrun?: boolean; firstrun?: boolean;
openNewWindow?: boolean; openNewWindow?: boolean;
openInSameWindow?: boolean; openInSameWindow?: boolean;
gotoLineMode?: boolean; gotoLineMode?: boolean;
diffMode?: boolean; diffMode?: boolean;
locale?: string; locale?: string;
waitForWindowClose?: boolean; waitForWindowClose?: boolean;
} }
function parseCli(): ICommandLineArguments { function parseCli(): ICommandLineArguments {
// Remove the Electron executable
let [, ...args] = process.argv;
// We need to do some argv massaging. First, remove the Electron executable // Id dev, remove the first argument: it's the app location
let args = Array.prototype.slice.call(process.argv, 1);
// Then, when in dev, remove the first non option argument, it will be the app location
if (!isBuilt) { if (!isBuilt) {
let i = (() => { [, ...args] = args;
for (let j = 0; j < args.length; j++) {
if (args[j][0] !== '-') {
return j;
}
}
return -1;
})();
if (i > -1) {
args.splice(i, 1);
}
} }
// Finally, any extra arguments in the 'argv' file should be prepended // Finally, prepend any extra arguments from the 'argv' file
if (fs.existsSync(path.join(appRoot, 'argv'))) { if (fs.existsSync(path.join(appRoot, 'argv'))) {
let extraargs: string[] = JSON.parse(fs.readFileSync(path.join(appRoot, 'argv'), 'utf8')); const extraargs: string[] = JSON.parse(fs.readFileSync(path.join(appRoot, 'argv'), 'utf8'));
args = extraargs.concat(args); args = [...extraargs, ...args];
} }
let opts = parseOpts(args); const opts = parseOpts(args);
let gotoLineMode = !!opts['g'] || !!opts['goto']; const gotoLineMode = !!opts['g'] || !!opts['goto'];
let debugBrkExtensionHostPort = parseNumber(args, '--debugBrkPluginHost', 5870); const debugBrkExtensionHostPort = parseNumber(args, '--debugBrkPluginHost', 5870);
let debugExtensionHostPort: number; let debugExtensionHostPort: number;
let debugBrkExtensionHost: boolean; let debugBrkExtensionHost: boolean;
if (debugBrkExtensionHostPort) { if (debugBrkExtensionHostPort) {
debugExtensionHostPort = debugBrkExtensionHostPort; debugExtensionHostPort = debugBrkExtensionHostPort;
debugBrkExtensionHost = true; debugBrkExtensionHost = true;
...@@ -190,7 +165,7 @@ function parseCli(): ICommandLineArguments { ...@@ -190,7 +165,7 @@ function parseCli(): ICommandLineArguments {
debugExtensionHostPort = parseNumber(args, '--debugPluginHost', 5870, isBuilt ? void 0 : 5870); debugExtensionHostPort = parseNumber(args, '--debugPluginHost', 5870, isBuilt ? void 0 : 5870);
} }
let pathArguments = parsePathArguments(args, gotoLineMode); const pathArguments = parsePathArguments(args, gotoLineMode);
return { return {
pathArguments: pathArguments, pathArguments: pathArguments,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册