[bug] [windows updater] updating tauri apps using updater fails if installed to `C:\Program Files`
Describe the bug
Some user of my tauri app want to install the application to C:\Program Files.
So, they launched the installer with Administer Privilege by left-clicking the installer exe and the initial installation works well with this method.
However, because the updater doesn't launch the installer with admin privilege, it will indefinitely fails to upgrade the tauri app.
the tauri updater should detect missing privilege and ask user for admin privilege OR ask admin privilege inside the installer if writing file fails with permission error.
Reproduction
- install some a little older tauri app into
C:\Program Filesby launching the installer exe with admin privilege - launch the tauri app without admin privilege and upgrade with tauri updater
- upgrading the app fails
You may use my ALCOM for real-world example. 0.1.0-rc.0 can be used as the old version https://github.com/vrc-get/vrc-get/releases/tag/gui-v0.1.0-rc.0
Expected behavior
Upgrading the app should not be failed and the update process should ask for admin privilage
Full tauri info output
> [email protected] tauri
> npm install && tauri info
up to date, audited 447 packages in 534ms
136 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[✔] Environment
- OS: Mac OS 14.4.1 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.75.0 (82e1608df 2023-12-21)
✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.12.2
- pnpm: 8.15.6
- yarn: 1.22.19
- npm: 10.5.0
[-] Packages
- tauri [RUST]: 1.6.1
- tauri-build [RUST]: 1.5.1
- wry [RUST]: 0.24.7
- tao [RUST]: 0.16.8
- tauri-cli [RUST]: 2.0.0-beta.11
- @tauri-apps/api [NPM]: 1.5.3 (outdated, latest: 1.5.4)
- @tauri-apps/cli [NPM]: 1.5.11 (outdated, latest: 1.5.12)
[-] App
- build-type: bundle
- CSP: unset
- distDir: out
- devPath: http://localhost:3000/
- framework: React (Next.js)
- bundler: Webpack
Stack trace
No response
Additional context
No response
Hmm, @amrbashir feedback is imo more valuable here than mine, but imho it'd be better to simply not allow installing a perUser installer with admin permissions and instead rely on the perMachine mode for that. There's more logic in the installer that expects a perUser installer to be actually be installed for just that user. idk what the best way forward is though.
I agree, perUser installers shouldn't at all interfere with perMachine mode.
sorry, I'm not good at Windows. What's the perUser installer means? is there any config to enable installing app for machine (not for user?)
See https://tauri.app/v1/api/config#nsisconfig.installmode
Basically perUser will try to install to C:\Users\<user>\AppData\Local (but users can pick another directory) and doesn't require Admin privileges to install, on the other hand, perMachine installs to C:\Program Files by default and requires Admin privileges to install.
There is also both mode which allows the user after starting the installer, to choose between perUser and perMachine
Sorry, I missed 'installmode' settings. Thank you.