main: fix --no-gui (ensure package.json is found by yargs) (issue #435)
This commit is contained in:
parent
0748468652
commit
0841499c40
2 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- bug fixes
|
||||
- editor: widgets/tabs not properly reordered when changing a widget or tab's index by more than 1
|
||||
- main: `--no-gui` switch not working when running the app from a different directory
|
||||
|
||||
## 0.40.3
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,9 @@ var options = {
|
|||
'fullscreen':{type:'boolean', describe:'launch in fullscreen mode (only affects the default gui, F11 to exit)'}
|
||||
}
|
||||
|
||||
// hack process.cwd to ensure yargs finds package.json
|
||||
var _cwd = process.cwd
|
||||
process.cwd = () => { return __dirname }
|
||||
|
||||
var argv = require('yargs')
|
||||
.help('help').usage('\nUsage:\n $0 [options]').alias('h', 'help')
|
||||
|
|
@ -111,6 +114,9 @@ var argv = require('yargs')
|
|||
|
||||
argv = argv.argv
|
||||
|
||||
// restore process.cwd
|
||||
process.cwd = _cwd
|
||||
|
||||
var cli = false
|
||||
for (i in argv) {
|
||||
if (i != '_' && i != '$0' && (argv[i]!=undefined && argv[i]!==false)) cli = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue