From a56de80ef89a340c88799c3a9669f605d5780ddf Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Mon, 30 Sep 2019 22:40:19 +0200 Subject: [PATCH] Include Visual C++ redistributable inside Windows Installer --- Cargo.lock | 2 +- Cargo.toml | 2 +- packager.py | 5 +++++ packager/win/modpath.iss | 2 +- packager/win/setupscript.iss | 10 +++++++--- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 261229e..b7e3ae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -329,7 +329,7 @@ dependencies = [ [[package]] name = "espanso" -version = "0.2.1" +version = "0.2.2" dependencies = [ "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index bae6602..827bd94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "espanso" -version = "0.2.1" +version = "0.2.2" authors = ["Federico Terzi "] license = "GPL-3.0" description = "Cross-platform Text Expander written in Rust" diff --git a/packager.py b/packager.py index 03e6510..8a0f141 100644 --- a/packager.py +++ b/packager.py @@ -6,6 +6,7 @@ import hashlib import click import shutil import toml +import urllib.request from dataclasses import dataclass PACKAGER_TARGET_DIR = "target/packager" @@ -75,6 +76,10 @@ def build_windows(package_info): TARGET_DIR = os.path.join(PACKAGER_TARGET_DIR, "win") os.makedirs(TARGET_DIR, exist_ok=True) + print("Downloading Visual C++ redistributable") + vc_redist_file = os.path.join(TARGET_DIR, "vc_redist.x64.exe") + urllib.request.urlretrieve("https://aka.ms/vs/16/release/vc_redist.x64.exe", vc_redist_file) + INSTALLER_NAME = f"espanso-win-installer" # Inno setup diff --git a/packager/win/modpath.iss b/packager/win/modpath.iss index c55ec60..a48ae7b 100644 --- a/packager/win/modpath.iss +++ b/packager/win/modpath.iss @@ -170,7 +170,7 @@ var begin taskname := ModPathName; if CurStep = ssPostInstall then - if IsTaskSelected(taskname) then + if WizardIsTaskSelected(taskname) then ModPath(); end; diff --git a/packager/win/setupscript.iss b/packager/win/setupscript.iss index 6e3ff13..169a4f3 100644 --- a/packager/win/setupscript.iss +++ b/packager/win/setupscript.iss @@ -37,11 +37,12 @@ Name: "english"; MessagesFile: "compiler:Default.isl" [Files] Source: "{{{executable_path}}}"; DestDir: "{app}"; Flags: ignoreversion Source: "{{{app_icon}}}"; DestDir: "{app}"; Flags: ignoreversion +Source: "vc_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] -Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\icon.ico" -Name: "{userstartup}\espanso"; Filename: "{app}\espanso.exe"; Tasks:StartMenuEntry; +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "start"; IconFilename: "{app}\icon.ico" +Name: "{userstartup}\espanso"; Filename: "{app}\espanso.exe"; Parameters: "start"; Tasks:StartMenuEntry; [Tasks] Name: modifypath; Description: Add espanso to PATH ( recommended ); @@ -60,7 +61,10 @@ end; #include "modpath.iss" [Run] -Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent +Filename: {tmp}\vc_redist.x64.exe; \ + Parameters: "/install /quiet"; \ + StatusMsg: "Installing Visual C++ 2019 Redistributable"; +Filename: "{app}\{#MyAppExeName}"; Parameters: "start"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent [UninstallRun] Filename: "{cmd}"; Parameters: "/C ""taskkill /im espanso.exe /f /t" \ No newline at end of file