зеркало из https://github.com/electron/electron.git
Don't use third party dependency in default_app.
This commit is contained in:
Родитель
1beeda170c
Коммит
c81a4bcafc
|
@ -2,7 +2,6 @@ var app = require('app');
|
|||
var dialog = require('dialog');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var optimist = require('optimist');
|
||||
|
||||
// Quit when all windows are closed and no other one is listening to this.
|
||||
app.on('window-all-closed', function() {
|
||||
|
@ -10,14 +9,27 @@ app.on('window-all-closed', function() {
|
|||
app.quit();
|
||||
});
|
||||
|
||||
var argv = optimist(process.argv.slice(1)).boolean('ci').argv;
|
||||
// Parse command line options.
|
||||
var argv = process.argv.slice(1);
|
||||
var option = { file: null, version: null };
|
||||
for (var i in argv) {
|
||||
if (argv[i] == '--version' || argv[i] == '-v') {
|
||||
option.version = true;
|
||||
break;
|
||||
} else if (argv[i][0] == '-') {
|
||||
continue;
|
||||
} else {
|
||||
option.file = argv[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Start the specified app if there is one specified in command line, otherwise
|
||||
// start the default app.
|
||||
if (argv._.length > 0) {
|
||||
if (option.file) {
|
||||
try {
|
||||
// Override app name and version.
|
||||
var packagePath = path.resolve(argv._[0]);
|
||||
var packagePath = path.resolve(option.file);
|
||||
var packageJsonPath = path.join(packagePath, 'package.json');
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
|
||||
|
@ -48,7 +60,7 @@ if (argv._.length > 0) {
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
} else if (argv.version) {
|
||||
} else if (option.version) {
|
||||
console.log('v' + process.versions['atom-shell']);
|
||||
process.exit(0);
|
||||
} else {
|
||||
|
|
|
@ -2,8 +2,5 @@
|
|||
"name": "atom-shell-default-app",
|
||||
"productName": "Atom Shell Default App",
|
||||
"version": "0.1.0",
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"optimist": "*"
|
||||
}
|
||||
"main": "main.js"
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ def main():
|
|||
enable_verbose_execute()
|
||||
update_submodules()
|
||||
update_node_modules('.')
|
||||
update_atom_modules('atom/browser/default_app')
|
||||
update_atom_modules('spec')
|
||||
bootstrap_brightray(args.url)
|
||||
if sys.platform == 'cygwin':
|
||||
|
|
Загрузка…
Ссылка в новой задаче