Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check VCRT and show installed/shipped version #4847

Merged
merged 3 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .CI/build-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
49 changes: 48 additions & 1 deletion .CI/chatterino-installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down