-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App open event is returning a string of arguments instead of an array (like App.argv) #2068
Comments
This should be working with latest version now. In 0.13 we changed to an optimized architecture so more features can be supported, see http://nwjs.io/blog/whats-new-in-0.13/ and it's good for keeping up with Chromium upstream -- we released with Node.js v6.0 and new Chromium versions within 1 day after upstream release. The new version would fixed many issues reported here and we're scrubbing them. This issue is closed as we believe it should be fixed. Please leave a message if it isn't and we'll reopen it. |
This issue has not been resolved yet, so I would say it should be reopened. In the documentation (http://docs.nwjs.io/en/latest/References/App/#event-openargs) it does say that the open event returns an string, but I agree this is not too useful. In a test I did in OS X, this string included "--user-data-dir=... --no-sandbox --flag-switches-begin --flag-switches-end --nwapp=...', so parsing it is not as simple as splitting the string. Maybe you could add a function for parsing the args string, so that it gets filtered and is returned as an array analogous to App.argv. |
test case: test/sanity/app-open-event issue: nwjs#2068
test case: test/sanity/app-open-event fixed nwjs/nw.js#2068
test case: test/sanity/app-open-event fixed nwjs/nw.js#2068
@mauvilsa I have PRs for sending original command line parameters as a string to |
@mauvilsa Not sure I understand the response. After the PR gets merged, will the argument to App.open be a string or an array? Also, I just started using the "open" event so I don't know what the backwards-compatibility entails. For example, currently the nw.js app bundle "open" argv string is a "file://" uri with the path of the file that was clicked. Will your PR change that? |
It will still be a string to be backward compatible with previous versions. For example, if you start a second instance with |
As described here, the open event for
gui.App
will return the full command line of the second call.I tried to parse the commandline, but experienced a strange behavior:
So, this seems to return a string, which can't be accessed directly.
In contrast, let's try the equal thing with
gui.App.argv
:To be more in line with
gui.App.argv
(which does return an array object), I would suggest, that the open event should also return an array instead of a string, which makes absolutely sense in my opinion, because a string isn't directly usable without further parsing.Tested with current v0.10.0-rc1 on Windows.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: