mongodb-js / electron-squirrel-startup

Default Squirrel.Windows event handler for your Electron apps.
Apache License 2.0
217 stars 41 forks source link

Created shortcut is targeted to the wrong directory #30

Open Sanderttt opened 7 years ago

Sanderttt commented 7 years ago

The created shortcut to my electron app is not working because it's pointing to the wrong directory

Properties of the desktop shortcut: Target: C:\Users\Win10H64\AppData\Local{app_name}}\dist.exe Start in: C:\Users\Win10H64\AppData\Local{app_name}}\app-0.0.1 The dir where the exe resides: C:\Users\Win10H64\AppData\Local{app_name}}\app-0.0.1\dist.exe

I'm using the following: electron: 1.4.15 electron-packager: 8.5.1 electron-winstaller: 2.5.2 electron-squirrel-startup: 1.0.0

I'm guessing that electron-squirrel-startup is the culprit in this issue. I found something similar here: https://github.com/Squirrel/Squirrel.Windows/issues/900

Any help would be appreciated

fodra commented 6 years ago

This also happens to me.

jpiepkow commented 6 years ago

put a pull request together to try and fix this.

https://github.com/mongodb-js/electron-squirrel-startup/pull/34

for now I pull all the functions out into my main.js and set target to something like this:

path.resolve(path.dirname(process.execPath),'..',app-${package.version},path.basename(process.execPath))

this may be different for you though depending but thats why the pull request above will let you pass in your own path.

jdheeter commented 6 years ago

@jpiepkow You Rock! It' seems odd to me that this issue has not been resolved, the default settings for this package create broken shortcuts.

Fourie-r commented 4 years ago

+1

ViciousIXIL commented 4 years ago

I fixed it by replacing: var target = path.basename(process.execPath); (line 18) with: var target = process.execPath;

jbpin commented 4 years ago

Does this will be fixed ?

Take-A-Byte commented 2 years ago

I fixed it by replacing: var target = path.basename(process.execPath); (line 18) with: var target = process.execPath;

This worked for me