node-auto-launch
node-auto-launch copied to clipboard
Why the name I pass to AutoLaunch constructor is not be used?
- The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows):
- Node version (run
node -v
): - auto-launch version:
- The options you're passing to auto-launch:
- Are you using NW.js or Electron?
- If so, which version?
- If you're using Electron, are you using auto-launch from the main process or a renderer process?
- Can you reproduce this with a simple Hello World example app?
- If needs be, would you be able to provide us with a simple app (as simple as possible) which reproduces the problem?
In your code in the AutoLaunch function, you call this.fixOpts(); After this function, the name we pass will become another value.
In the fixOpts, I find author changes the this.opts.appName. But I don't know why to do this. If I comment out these code, then the name written in Registry will be what I pass.
In fixOpts, I comment out part of the code. Like below,
AutoLaunch.prototype.fixOpts = function() { var tempPath; this.opts.appPath = this.opts.appPath.replace(//$/, ''); if (/darwin/.test(process.platform)) { this.opts.appPath = this.fixMacExecPath(this.opts.appPath, this.opts.mac); } // if (this.opts.appPath.indexOf('/') !== -1) { // tempPath = this.opts.appPath.split('/'); // this.opts.appName = tempPath[tempPath.length - 1]; // } else if (this.opts.appPath.indexOf('\') !== -1) { // tempPath = this.opts.appPath.split('\'); // this.opts.appName = tempPath[tempPath.length - 1]; // this.opts.appName = this.opts.appName.substr(0, this.opts.appName.length - '.exe'.length); // } // if (/darwin/.test(process.platform)) { // if (this.opts.appName.indexOf('.app', this.opts.appName.length - '.app'.length) !== -1) { // return this.opts.appName = this.opts.appName.substr(0, this.opts.appName.length - '.app'.length); // } // } };
I just wonder if this is OK or not.
I noticed the same thing... Without changing anything in the package's code (it obviously is a flaw that needs to be addressed, but the package doesn't currently seem actively maintained...), you can just overwrite the value after initialisation:
AutoLauncher.opts.appName = 'YourAppName'
Please see that we're looking for contributors / maintainers: #64.
I'm happy to give access to people who are willing to help improve things, merge pull-requests, close issues, etc.
Partially fixed in upcoming 6.0.0-rc.2. However, still used under macOS and I think I understand what was the purpose of this "clean up". It is not so much a clean up, but a fix when needed for some scenarios. It should have been documented and better applied per OS.
Other improvements to come.