You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that when cross compiling / bundling from Mac for Windows, the resources I added that were not in the root directory ended up in the root directory after install on Windows, even though the subdirectories had been created.
The reason for this is that in the installer.nsi file it does this:
Where this.[1] is a PathBuf generated by generate_resource_data in nsis.rs. When bundling on Windows this will render with a \ and when bundling on *nix it will bundle with a /. Nsis always expects the path separators to be a \ and it appears to just ignore /
I've fixed it for myself by adding a handlebars helper:
handlebars.register_helper(
"win-path",
Box::new(
|h: &handlebars::Helper<'_, '_>,
_: &Handlebars<'_>,
_: &handlebars::Context,
_: &mut handlebars::RenderContext<'_, '_>,
out: &mut dyn handlebars::Output|
-> handlebars::HelperResult {
let param = h.param(0).unwrap();
let value = param.value().render();
let path = value.replace(MAIN_SEPARATOR_STR, "\\");
out.write(&path)?;
Ok(())
},
),
);
and changing the installer.nsi line:
File /a "/oname={{win-path this.[1]}}" "{{@key}}"
which might not be the optimal fix but it proves the problem.
according to tauri info your cli is 1.5.11, can you update that to 1.5.12 and try again? This should have been fixed as part of #9281 which was part of 1.5.12 assuming of course i didn't miss anything...
Describe the bug
I found that when cross compiling / bundling from Mac for Windows, the resources I added that were not in the root directory ended up in the root directory after install on Windows, even though the subdirectories had been created.
The reason for this is that in the installer.nsi file it does this:
Where this.[1] is a PathBuf generated by
generate_resource_data
in nsis.rs. When bundling on Windows this will render with a\
and when bundling on *nix it will bundle with a/
. Nsis always expects the path separators to be a\
and it appears to just ignore/
I've fixed it for myself by adding a handlebars helper:
and changing the installer.nsi line:
which might not be the optimal fix but it proves the problem.
Reproduction
Add a resource in a subdirectory like:
in tauri.conf.json and then bundle on windows as per https://tauri.app/v1/guides/building/cross-platform
Expected behavior
Resources should end up in the same location regardless of platform the installer is built on
Full
tauri info
outputThe text was updated successfully, but these errors were encountered: