Teamwork / node-auto-launch

Launch applications or executables at login (Mac, Windows, and Linux)
MIT License
941 stars 111 forks source link

Why the name I pass to AutoLaunch constructor is not be used? #92

Open kingeaglewang opened 5 years ago

kingeaglewang commented 5 years ago

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.

kingeaglewang commented 5 years ago

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.

Connum commented 5 years ago

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'
adam-lynch commented 5 years ago

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.

Oxalin commented 5 months ago

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.