Extract helper function to load specified app
This commit is contained in:
parent
8df3856c8f
commit
2e96cab6aa
1 changed files with 8 additions and 4 deletions
|
@ -234,12 +234,10 @@ if (option.modules.length > 0) {
|
||||||
require('module')._preloadModules(option.modules);
|
require('module')._preloadModules(option.modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the specified app if there is one specified in command line, otherwise
|
function loadPackagePath(packagePath) {
|
||||||
// start the default app.
|
|
||||||
if (option.file && !option.webdriver) {
|
|
||||||
try {
|
try {
|
||||||
// Override app name and version.
|
// Override app name and version.
|
||||||
var packagePath = path.resolve(option.file);
|
packagePath = path.resolve(packagePath);
|
||||||
var packageJsonPath = path.join(packagePath, 'package.json');
|
var packageJsonPath = path.join(packagePath, 'package.json');
|
||||||
if (fs.existsSync(packageJsonPath)) {
|
if (fs.existsSync(packageJsonPath)) {
|
||||||
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
|
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
|
||||||
|
@ -270,6 +268,12 @@ if (option.file && !option.webdriver) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the specified app if there is one specified in command line, otherwise
|
||||||
|
// start the default app.
|
||||||
|
if (option.file && !option.webdriver) {
|
||||||
|
loadPackagePath(option.file);
|
||||||
} else if (option.version) {
|
} else if (option.version) {
|
||||||
console.log('v' + process.versions.electron);
|
console.log('v' + process.versions.electron);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|
Loading…
Reference in a new issue