electron: [Bug]: Windows: openAtLogin doesn't work if app install path has space
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
16.06
What operating system are you using?
Windows
Operating System Version
Windows 11 Pro 22000.376
What arch are you using?
x64
Last Known Working Electron version
none
Expected Behavior
App starts up on login after openAtLogin is set to true. Specifically, the registry value installed includes escaping or surrounding entire path with " so the spaces don’t break startup.
Actual Behavior
App does not start on login up after openAtLogin is set to true. The registry value installed is a raw string value of the path, and spaces in that path mess things up.
Testcase Gist URL
- Create a windows account with a space in the username
- Log into that account
- Install Electron Fiddle
- Load this gist (it will automatically set
openAtLogin: true) https://gist.github.com/scottnonnenberg-signal/7b5152ecafb41222a90648d782bfd509 - Log out
- Log back in
Note: The app should start up when you log in, but it doesn’t. This is different from users who have no space in their name. Things work as expected for them.
Additional Information
You can repro this on recent versions of Signal Desktop.
Original user bug here: https://github.com/signalapp/Signal-Desktop/issues/5720
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (3 by maintainers)
Commits related to this issue
- fix: auto start not working on Windows when username contains spaces ref #726 Electron bug https://github.com/electron/electron/issues/32657 — committed to akiver/cs-demo-manager by akiver 6 months ago
- fix: auto start not working on Windows when username contains spaces ref #726 Electron bug https://github.com/electron/electron/issues/32657 — committed to akiver/cs-demo-manager by akiver 6 months ago
This issue has been reported here too.
As a workaround, I’m adding quotes using
registry-jsif necessary. See this commit