Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Amr Bashir <[email protected]>
  • Loading branch information
pewsheen and amrbashir committed Aug 31, 2023
1 parent be892ba commit ac2dffd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
6 changes: 5 additions & 1 deletion core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ pub struct WixConfig {
}

/// Compression algorithms used in the NSIS installer.
///
/// See <https://nsis.sourceforge.io/Reference/SetCompressor>
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
Expand Down Expand Up @@ -494,7 +496,9 @@ pub struct NsisConfig {
#[serde(default, alias = "display-language-selector")]
pub display_language_selector: bool,
/// Set the compression algorithm used to compress files in the installer.
pub set_compressor: Option<NsisCompressor>,
///
/// See <https://nsis.sourceforge.io/Reference/SetCompressor>
pub compression: Option<NsisCompressor>,
}

/// Install Modes for the NSIS installer.
Expand Down
4 changes: 2 additions & 2 deletions tooling/bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ pub struct NsisSettings {
/// Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not.
/// By default the OS language is selected, with a fallback to the first language in the `languages` array.
pub display_language_selector: bool,
/// Set compression algorithm used in the installer.
pub set_compressor: Option<NsisCompressor>,
/// Set compression algorithm used to compress files in the installer.
pub compression: Option<NsisCompressor>,
}

/// The Windows bundle settings.
Expand Down
19 changes: 9 additions & 10 deletions tooling/bundler/src/bundle/windows/nsis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,15 @@ fn build_nsis_app_installer(
to_json(dunce::canonicalize(sidebar_image)?),
);
}
if let Some(compressor) = &nsis.set_compressor {
data.insert(
"set_compressor",
to_json(match compressor {
NsisCompressor::Zlib => "zlib",
NsisCompressor::Bzip2 => "bzip2",
NsisCompressor::Lzma => "lzma",
}),
);
}
data.insert(
"set_compressor",
to_json(match compressor.unwrap_or(NsisCompressor::Lzma) {
NsisCompressor::Zlib => "zlib",
NsisCompressor::Bzip2 => "bzip2",
NsisCompressor::Lzma => "lzma",
}),
);


data.insert(
"display_language_selector",
Expand Down
8 changes: 2 additions & 6 deletions tooling/bundler/src/bundle/windows/templates/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,15 @@
!define WEBVIEW2INSTALLERPATH "{{webview2_installer_path}}"
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}"
!define MANUPRODUCTKEY "Software\${MANUFACTURER}\${PRODUCTNAME}"
!define SETCOMPRESSOR "{{set_compressor}}"
!define COMPRESSION "{{compression}}"

Name "${PRODUCTNAME}"
BrandingText "{{copyright}}"
OutFile "${OUTFILE}"
Unicode true

; Set the compression algorithm. Default is LZMA.
!if "${SETCOMPRESSOR}" == ""
SetCompressor /SOLID lzma
!else
SetCompressor /SOLID "${SETCOMPRESSOR}"
!endif
SetCompressor /SOLID "${SETCOMPRESSOR}"

VIProductVersion "${VERSIONWITHBUILD}"
VIAddVersionKey "ProductName" "${PRODUCTNAME}"
Expand Down

0 comments on commit ac2dffd

Please sign in to comment.