mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
* add icon to msi * remove print * make attohttpc windows only * make attohttpc error windows only * copy icon files to resource folder in output. * add ico to template * remove print * remove duplicate * add uninstaller to wix * fix typos * fix program flow * add windows icon logic to template. * update serde, phf and change includedir to tauri * update next.js with new tauri setup * update monolith * remove unnessecary deps * remove updater.rs and deps * update react examples * update vue example * Revert "update vue example" This reverts commita5d58f55b4. * Revert "update react examples" This reverts commitcce215f97e. * Revert "remove updater.rs and deps" This reverts commit8d422294f4. * Revert "remove unnessecary deps" This reverts commit30e023f383. * Revert "update monolith" This reverts commitfac097f51a. * Revert "update next.js with new tauri setup" This reverts commitcaf5f198ea. * revert smoke-test changes * revert smoke-test changes * fix conflicts * fix conflicts
This commit is contained in:
committed by
GitHub
parent
7dc2036095
commit
078ae1dfda
@@ -33,6 +33,7 @@ toml = "0.5.5"
|
||||
uuid = { version = "0.8", features = ["v5"] }
|
||||
walkdir = "2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
attohttpc = { version = "0.7.0" }
|
||||
|
||||
[target.'cfg(not(target_os = "linux"))'.dependencies]
|
||||
|
||||
@@ -21,17 +21,21 @@
|
||||
|
||||
<Package Id="*"
|
||||
Keywords="Installer"
|
||||
InstallerVersion="200"
|
||||
InstallerVersion="450"
|
||||
Languages="1033"
|
||||
Compressed="yes"
|
||||
InstallScope="perMachine"
|
||||
SummaryCodepage="1252"/>
|
||||
|
||||
<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
|
||||
|
||||
<WixVariable Id="WixUIBannerBmp" Value="{{{icon_path}}}" />
|
||||
|
||||
<Icon Id="ProductIcon" SourceFile="{{{icon_path}}}"/>
|
||||
<Property Id="ARPPRODUCTICON" Value="ProductIcon"/>
|
||||
<Property Id="ARPNOREPAIR" Value="1"/>
|
||||
<Property Id="ARPNOMODIFY" Value="1"/>
|
||||
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
|
||||
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
|
||||
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" /> <!-- Remove modify -->
|
||||
|
||||
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
|
||||
@@ -43,16 +47,45 @@
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<DirectoryRef Id="APPLICATIONFOLDER">
|
||||
<Component Id="CMP_ReadFileShortcut"
|
||||
Guid="1AF06B42-CD42-4AED-959F-36DB5E512046">
|
||||
|
||||
<Shortcut Id="UninstallShortcut"
|
||||
Name="Uninstall {{{product_name}}}"
|
||||
Description="Uninstalls {{{product_name}}}"
|
||||
Target="[System64Folder]msiexec.exe"
|
||||
Arguments="/x [ProductCode]" />
|
||||
|
||||
<RemoveFolder Id="RemoveDIR_Shortcuts"
|
||||
On="uninstall" />
|
||||
|
||||
<RegistryValue Root="HKCU"
|
||||
Key="Software\{{{manufacturer}}}\{{{product_name}}}"
|
||||
Name="installed"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes" />
|
||||
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<Feature
|
||||
Id="MainProgram"
|
||||
Title="Application"
|
||||
Description="Installs the executable."
|
||||
Description="Installs {{{product_name}}}."
|
||||
Level="1"
|
||||
ConfigurableDirectory="APPLICATIONFOLDER"
|
||||
AllowAdvertise="no"
|
||||
Display="expand"
|
||||
Absent="disallow">
|
||||
|
||||
<Feature Id="ShortcutsFeature"
|
||||
Title="Shortcuts"
|
||||
Level="1">
|
||||
<ComponentRef Id="CMP_ReadFileShortcut" />
|
||||
</Feature>
|
||||
|
||||
<Feature
|
||||
Id="Environment"
|
||||
Title="PATH Environment Variable"
|
||||
@@ -64,6 +97,5 @@
|
||||
</Feature>
|
||||
|
||||
<SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize"/>
|
||||
|
||||
</Product>
|
||||
</Wix>
|
||||
@@ -1,5 +1,7 @@
|
||||
use super::common;
|
||||
use super::path_utils::{copy, Options};
|
||||
use super::settings::Settings;
|
||||
|
||||
use handlebars::Handlebars;
|
||||
use lazy_static::lazy_static;
|
||||
use sha2::Digest;
|
||||
@@ -44,11 +46,42 @@ lazy_static! {
|
||||
|
||||
handlebars
|
||||
.register_template_string("main.wxs", include_str!("templates/main.wxs"))
|
||||
.or_else(|e| Err(e.to_string()))
|
||||
.unwrap();
|
||||
handlebars
|
||||
};
|
||||
}
|
||||
|
||||
fn copy_icons(settings: &Settings) -> crate::Result<PathBuf> {
|
||||
let base_dir = settings.binary_path();
|
||||
let base_dir = base_dir.parent().expect("Failed to get dir");
|
||||
|
||||
let resource_dir = base_dir.join("resources");
|
||||
|
||||
let mut image_path = PathBuf::from(settings.project_out_directory());
|
||||
|
||||
// pop off till in tauri_src dir
|
||||
image_path.pop();
|
||||
image_path.pop();
|
||||
|
||||
// get icon dir and icon file.
|
||||
let image_path = image_path.join("icons");
|
||||
let opts = super::path_utils::Options::default();
|
||||
|
||||
copy(
|
||||
image_path,
|
||||
&resource_dir,
|
||||
&Options {
|
||||
copy_files: true,
|
||||
overwrite: true,
|
||||
..opts
|
||||
},
|
||||
)
|
||||
.or_else(|e| Err(e.to_string()))?;
|
||||
|
||||
Ok(resource_dir)
|
||||
}
|
||||
|
||||
// Function used to download Wix and VC_REDIST. Checks SHA256 to verify the download.
|
||||
fn download_and_verify(url: &str, hash: &str) -> crate::Result<Vec<u8>> {
|
||||
common::print_info(format!("Downloading {}", url).as_str())?;
|
||||
@@ -322,6 +355,9 @@ pub fn build_wix_app_installer(
|
||||
let path_guid = generate_package_guid(settings).to_string();
|
||||
data.insert("path_component_guid", &path_guid.as_str());
|
||||
|
||||
let shortcut_guid = generate_package_guid(settings).to_string();
|
||||
data.insert("shortcut_guid", &shortcut_guid.as_str());
|
||||
|
||||
let app_exe_name = settings.binary_name().to_string();
|
||||
data.insert("app_exe_name", &app_exe_name);
|
||||
|
||||
@@ -329,11 +365,12 @@ pub fn build_wix_app_installer(
|
||||
|
||||
data.insert("app_exe_source", &app_exe_source);
|
||||
|
||||
let image_path = PathBuf::from("../../../../icons/icon.ico")
|
||||
.display()
|
||||
.to_string();
|
||||
// copy icons from icons folder to resource folder near msi
|
||||
let image_path = copy_icons(&settings)?;
|
||||
|
||||
data.insert("icon_path", &image_path);
|
||||
let path = image_path.join("icon.ico").display().to_string();
|
||||
|
||||
data.insert("icon_path", path.as_str());
|
||||
|
||||
let temp = HANDLEBARS
|
||||
.render("main.wxs", &data)
|
||||
|
||||
@@ -27,7 +27,7 @@ error_chain! {
|
||||
Term(::term::Error);
|
||||
Toml(::toml::de::Error);
|
||||
Walkdir(::walkdir::Error);
|
||||
HttpError(::attohttpc::Error);
|
||||
HttpError(::attohttpc::Error) #[cfg(windows)];
|
||||
StripError(std::path::StripPrefixError);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user