main: fix --no-gui (ensure package.json is found by yargs) (issue #435)

This commit is contained in:
jean-emmanuel 2018-12-28 13:56:47 +01:00
parent 28d2f99fdc
commit 2e317b7843
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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