Check VCRT and show installed/shipped version (#4847)

* feat: check VCRT and give more feedback

* chore: add changelog entry

* fix: use full product name
This commit is contained in:
nerix 2023-09-30 12:22:39 +02:00 committed by GitHub
parent 783c7530f3
commit bdd7d95092
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 1 deletions

View file

@ -36,10 +36,14 @@ if ($null -eq $Env:VCToolsRedistDir) {
}
Copy-Item "$Env:VCToolsRedistDir\vc_redist.x64.exe" .;
$VCRTVersion = (Get-Item "$Env:VCToolsRedistDir\vc_redist.x64.exe").VersionInfo;
# Build the installer
ISCC `
/DWORKING_DIR="$($pwd.Path)\" `
/DINSTALLER_BASE_NAME="$installerBaseName" `
/DSHIPPED_VCRT_BUILD="$($VCRTVersion.FileBuildPart)" `
/DSHIPPED_VCRT_VERSION="$($VCRTVersion.FileDescription)" `
$defines `
/O. `
"$PSScriptRoot\chatterino-installer.iss";

View file

@ -13,6 +13,15 @@
#define WORKING_DIR ""
#endif
; Set to the build part of the VCRT version
#ifndef SHIPPED_VCRT_BUILD
#define SHIPPED_VCRT_BUILD 0
#endif
; Set to the string representation of the VCRT version
#ifndef SHIPPED_VCRT_VERSION
#define SHIPPED_VCRT_VERSION ?
#endif
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
@ -56,7 +65,8 @@ SetupWindowTitle=Setup - %1 (Nightly)
#endif
[Tasks]
Name: "vcredist"; Description: "Install the required Visual C++ 2015/2017/2019/2022 Redistributable";
; Only show this option if the VCRT can be updated.
Name: "vcredist"; Description: "Install the required {#SHIPPED_VCRT_VERSION} ({code:VCRTDescription})"; Check: NeedsNewVCRT();
; GroupDescription: "{cm:AdditionalIcons}";
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked
Name: "freshinstall"; Description: "Fresh install (delete old settings/logs)"; Flags: unchecked
@ -85,3 +95,40 @@ Type: filesandordirs; Name: "{userappdata}\Chatterino2"; Tasks: freshinstall
[UninstallDelete]
; Delete cache on uninstall
Type: filesandordirs; Name: "{userappdata}\Chatterino2\Cache"
[Code]
// Get the VCRT version as a string. Null if the version could not be found.
function GetVCRT(): Variant;
var
VCRTVersion: String;
begin
Result := Null;
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', VCRTVersion) then
Result := VCRTVersion;
end;
// Gets a description about the VCRT installed vs shipped.
// This doesn't compare the versions.
function VCRTDescription(Param: String): String;
var
VCRTVersion: Variant;
begin
VCRTVersion := GetVCRT;
if VarIsNull(VCRTVersion) then
Result := 'none is installed'
else
Result := VCRTVersion + ' is installed';
end;
// Checks if a new VCRT is needed by comparing the builds.
function NeedsNewVCRT(): Boolean;
var
VCRTBuild: Cardinal;
begin
Result := True;
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Bld', VCRTBuild) then
begin
if VCRTBuild >= {#SHIPPED_VCRT_BUILD} then
Result := False;
end;
end;

View file

@ -5,6 +5,7 @@
- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
- Minor: The account switcher is now styled to match your theme. (#4817)
- Minor: Add an invisible resize handle to the bottom of frameless user info popups and reply thread popups. (#4795)
- Minor: The installer now checks for the VC Runtime version and shows more info when it's outdated. (#4847)
- Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834)
- Bugfix: Fixed a performance issue when displaying replies to certain messages. (#4807)
- Bugfix: Fixed a data race when disconnecting from Twitch PubSub. (#4771)