Skip to content

Commit 413f01c

Browse files
Sean Kenneth DohertyLegend-Master
andauthored
enhance(bundler): add more NSIS path error contexts (#15403)
* fix(bundler): clarify nsis config path errors * Address NSIS path context review * Fix NSIS test module order * Address NSIS review comments * Add more `fs_context`s --------- Co-authored-by: Tony <legendmastertony@gmail.com>
1 parent 499df79 commit 413f01c

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": "patch:enhance"
3+
---
4+
5+
Improve NSIS configuration path errors so missing installer icons and images include the related config key and path.

crates/tauri-bundler/src/bundle/windows/nsis/mod.rs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ fn build_nsis_app_installer(
319319
);
320320

321321
if let Some(license_file) = settings.license_file() {
322-
let license_file = dunce::canonicalize(license_file)?;
322+
let license_file = dunce::canonicalize(&license_file)
323+
.fs_context("failed to resolve `bundle > licenseFile`", license_file)?;
323324
let license_file_with_bom = output_path.join("license_file");
324325
let content = std::fs::read(license_file)?;
325326
write_utf8_with_bom(&license_file_with_bom, content)?;
@@ -339,37 +340,58 @@ fn build_nsis_app_installer(
339340
if let Some(installer_icon) = &nsis.installer_icon {
340341
data.insert(
341342
"installer_icon",
342-
to_json(dunce::canonicalize(installer_icon)?),
343+
to_json(dunce::canonicalize(installer_icon).fs_context(
344+
"failed to resolve `bundle > windows > nsis > installerIcon`",
345+
installer_icon.to_owned(),
346+
)?),
343347
);
344348
}
345349

346350
if let Some(header_image) = &nsis.header_image {
347-
data.insert("header_image", to_json(dunce::canonicalize(header_image)?));
351+
data.insert(
352+
"header_image",
353+
to_json(dunce::canonicalize(header_image).fs_context(
354+
"failed to resolve `bundle > windows > nsis > headerImage`",
355+
header_image.to_owned(),
356+
)?),
357+
);
348358
}
349359

350360
if let Some(sidebar_image) = &nsis.sidebar_image {
351361
data.insert(
352362
"sidebar_image",
353-
to_json(dunce::canonicalize(sidebar_image)?),
363+
to_json(dunce::canonicalize(sidebar_image).fs_context(
364+
"failed to resolve `bundle > windows > nsis > sidebarImage`",
365+
sidebar_image.to_owned(),
366+
)?),
354367
);
355368
}
356369

357370
if let Some(uninstaller_icon) = &nsis.uninstaller_icon {
358371
data.insert(
359372
"uninstaller_icon",
360-
to_json(dunce::canonicalize(uninstaller_icon)?),
373+
to_json(dunce::canonicalize(uninstaller_icon).fs_context(
374+
"failed to resolve `bundle > windows > nsis > uninstallerIcon`",
375+
uninstaller_icon.to_owned(),
376+
)?),
361377
);
362378
}
363379

364380
if let Some(uninstaller_header_image) = &nsis.uninstaller_header_image {
365381
data.insert(
366382
"uninstaller_header_image",
367-
to_json(dunce::canonicalize(uninstaller_header_image)?),
383+
to_json(dunce::canonicalize(uninstaller_header_image).fs_context(
384+
"failed to resolve `bundle > windows > nsis > uninstallerHeaderImage`",
385+
uninstaller_header_image.to_owned(),
386+
)?),
368387
);
369388
}
370389

371390
if let Some(installer_hooks) = &nsis.installer_hooks {
372-
let installer_hooks = dunce::canonicalize(installer_hooks)?;
391+
let installer_hooks = dunce::canonicalize(installer_hooks).fs_context(
392+
"failed to resolve `bundle > windows > nsis > installerHooks`",
393+
installer_hooks.to_owned(),
394+
)?;
373395
data.insert("installer_hooks", to_json(installer_hooks));
374396
}
375397

0 commit comments

Comments
 (0)