diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 8fc7691467f..dbdb7133422 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -439,6 +439,8 @@ pub struct WixConfig { } /// Compression algorithms used in the NSIS installer. +/// +/// See #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -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, + /// + /// See + pub compression: Option, } /// Install Modes for the NSIS installer. diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index 6f2200b50d1..bf85fa62378 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -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, + /// Set compression algorithm used to compress files in the installer. + pub compression: Option, } /// The Windows bundle settings. diff --git a/tooling/bundler/src/bundle/windows/nsis.rs b/tooling/bundler/src/bundle/windows/nsis.rs index e45b5b01c43..bce01b9621b 100644 --- a/tooling/bundler/src/bundle/windows/nsis.rs +++ b/tooling/bundler/src/bundle/windows/nsis.rs @@ -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", diff --git a/tooling/bundler/src/bundle/windows/templates/installer.nsi b/tooling/bundler/src/bundle/windows/templates/installer.nsi index 7eb7958442c..9194455cac3 100644 --- a/tooling/bundler/src/bundle/windows/templates/installer.nsi +++ b/tooling/bundler/src/bundle/windows/templates/installer.nsi @@ -28,7 +28,7 @@ !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}}" @@ -36,11 +36,7 @@ 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}"