-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(windows): Fix Windows System User build failures by using the current directory for bundling tools (fix: 9895) #9914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to use target
directory before but we changed it to use cache_dir
because these files rarely change so it makes sense to just cache them for every project and the few files that change, we detect that and update them.
That said, I'd like to keep the current behavior, and add this either as a fallback when current cache_dir fails, or as a separate CLI flag (or environment flag)
Agreed with Amr, just wanted to mention that this would need a proper target dir detection (similar to how the |
…ting the fix behind a Tauri configuration feature flag, default false
Great callout, thank you folks. I like the suggestion to keep the existing behavior as default given it is more optimal for most use cases. I've put the feature behind a feature flag in the Tauri config json with schema validation. I believe this approach accomplishes the best of both worlds: gating the feature, but also minimizing risk of build errors associated with CLI usage and flags, by leveraging the feature via schema validation. After all, someone who needs this feature needs this all the time, so setting it once in the config and being safe would be preferred (at least speaking from the voice of one such person who wants to consume this fix). Tested that the new json config property is fully optional. If not provided at all, defaults to false (aka existing behavior). Also tested if false is explicitly provided (again, existing behavior). Finally, when true is provided (new behavior, working). As for the callout on getting to |
…tation and tool path folder
As per offline discussion in Discord, moved the feature from |
Hmm, maybe something like this (copy pasted from somewhere else in the cli) let mut path = get_cargo_metadata()
.with_context(|| "failed to get cargo metadata")?
.target_directory; Using the parent dir of project_out_directory is probably a bit awkward because it will be different if the user uses the |
I just tested this PR and didn't make any changes to |
Well, unrelated, I found out that #9902 caused the problem. |
Closes #9895 with details on the issue there.
As a summary: Tauri uses Wix/NSIS toolsets for bundling .msi and .exe files respectively. Currently, it installs/retrieves these toolchains from the user app directory. However, this approach fails if the current user is a System user, since their app directory (the system directory) is restricted, which results in the bundling failing due to unusable Wix/NSIS executables.
This PR solves the problem by instead installing/retrieving the Wix/NSIS toolset from the current project directory, in
target/tools
. For example, Wix would be attarget/tools/Wix
. This would:Tested this code change locally:
cargo test
cargo clippy