From 88fe425fa3ebed42b0621b18015c9c9e24c0592b Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 19 Aug 2016 22:29:09 +0100 Subject: [PATCH] Update the readme and installer for the MSVC runtime requirement The readme now informs users that the MSVC 2015 x86 redistributable is required, and the installer will download and install it if it is not detected as being already installed. --- README.md | 2 +- docs/LOOT Readme.html | 2 +- scripts/installer.iss | 96 +++++++++++++++++++++++++++++++++---------- 3 files changed, 77 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ce05e51c..3b201d9a 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,6 @@ You may also need to set `BOOST_ROOT` if CMake cannot find Boost. Packaging scripts are provided for creating an installer on Windows and compressed archives on Windows and Linux. -Run the `scripts/installer.iss` [Inno Setup](http://www.jrsoftware.org/isinfo.php) script to build an installer executable in the `build` folder. If the unofficial Korean and Simplified Chinese Inno Setup translation files are installed alongside the official translation files, then the installer script will also offer those language options. If they are not found, the installer will be built without them. +Run the `scripts/installer.iss` [Inno Setup](http://www.jrsoftware.org/isinfo.php) script to build an installer executable in the `build` folder. The script requires the [Inno Download Plugin](https://bitbucket.org/mitrich_k/inno-download-plugin) to be installed. If the unofficial Korean and Simplified Chinese Inno Setup translation files are installed alongside the official translation files, then the installer script will also offer those language options. If they are not found, the installer will be built without them. The archive packaging script requires [Git](https://git-scm.com/), and on Windows it also requires [7-Zip](http://7-zip.org), while on Linux it requires `tar` and `xz`. It can be run using `node scripts/archive.js`, and creates archives for LOOT, its API and the metadata validator in the `build` folder. The archives are named as described in the Downloads section above. diff --git a/docs/LOOT Readme.html b/docs/LOOT Readme.html index abbbe82e..6046f7fd 100644 --- a/docs/LOOT Readme.html +++ b/docs/LOOT Readme.html @@ -229,7 +229,7 @@ figure > div {

LOOT requires Windows 7 or later.

-

LOOT can be installed either using its automated installer or manually. To install LOOT manually, extract the downloaded archive to a location of your choice. +

LOOT can be installed either using its automated installer or manually. If you are using the installer, just run it and follow the wizard steps. If installing manually, extract the downloaded archive to a location of your choice, then download and install the MSVC 2015 x86 redistributable if you don't already have it installed.

If LOOT was installed using the installer, then use the uninstaller linked to in the Start Menu to uninstall LOOT. If LOOT was installed manually:

    diff --git a/scripts/installer.iss b/scripts/installer.iss index 10fc9636..af4ecc2b 100644 --- a/scripts/installer.iss +++ b/scripts/installer.iss @@ -2,6 +2,14 @@ ; This file must be encoded in UTF-8 WITH a BOM for Unicode text to ; be displayed correctly. +#include +#include +#include +#include +#include +#include +#include + #define MyAppName "LOOT" #define MyAppVersion "0.9.2" #define MyAppPublisher "LOOT Team" @@ -139,6 +147,7 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent +Filename: "{tmp}\vc_redist.x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist [Registry] ; Store install path for backwards-compatibility with old NSIS install script behaviour. @@ -186,26 +195,6 @@ zh_CN.DeleteUserFiles=你想要删除你的设置和用户数据吗? es.DeleteUserFiles=¿Quieres borrar sus ajustes y metadatos de usuario? [Code] -// Query user whether their data files should be deleted on uninstall. -procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep); -begin - // Don't remove user data if the uninstall is silent. - if UninstallSilent then - exit; - if CurUninstallStep = usUninstall then begin - if MsgBox(CustomMessage('DeleteUserFiles'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES - then begin - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\LOOTDebugLog.txt')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\CEFDebugLog.txt')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\settings.yaml')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Oblivion\userlist.yaml')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Skyrim\userlist.yaml')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Fallout3\userlist.yaml')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\FalloutNV\userlist.yaml')); - DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Fallout4\userlist.yaml')); - end; - end; -end; // Set LOOT's language in settings.yaml procedure SetLootLanguage(); var @@ -236,6 +225,7 @@ begin SaveStringToFile(File, LanguageLine, False); end; end; + // Run a previous install's uninstaller before starting this installation. procedure RunPreviousVersionUninstaller(); var @@ -259,11 +249,75 @@ begin end; end; end; + +function VCRedistNeedsInstall: Boolean; +var + VersionMajor : Integer; + VersionMinor: Integer; + VersionBld: Integer; + RegKey: String; + IsRuntimeInstalled: Cardinal; + InstalledVersionMajor: Cardinal; + InstalledVersionMinor: Cardinal; + InstalledVersionBld: Cardinal; +begin + VersionMajor := 14; + VersionMinor := 0; + VersionBld := 24212; + RegKey := 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86'; + IsRuntimeInstalled := 0; + InstalledVersionMajor := 0; + InstalledVersionMinor := 0; + InstalledVersionBld := 0; + + RegQueryDWordValue(HKLM, RegKey, 'Installed', IsRuntimeInstalled); + RegQueryDWordValue(HKLM, RegKey, 'Major', InstalledVersionMajor); + RegQueryDWordValue(HKLM, RegKey, 'Minor', InstalledVersionMinor); + RegQueryDWordValue(HKLM, RegKey, 'Bld', InstalledVersionBld); + + Result := (IsRuntimeInstalled = 0) + or (InstalledVersionMajor < VersionMajor) + or (InstalledVersionMinor < VersionMinor) + or (InstalledVersionBld < VersionBld); +end; + +// Query user whether their data files should be deleted on uninstall. +procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep); +begin + // Don't remove user data if the uninstall is silent. + if UninstallSilent then + exit; + if CurUninstallStep = usUninstall then begin + if MsgBox(CustomMessage('DeleteUserFiles'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES + then begin + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\LOOTDebugLog.txt')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\CEFDebugLog.txt')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\settings.yaml')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Oblivion\userlist.yaml')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Skyrim\userlist.yaml')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Fallout3\userlist.yaml')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\FalloutNV\userlist.yaml')); + DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Fallout4\userlist.yaml')); + end; + end; +end; + +procedure InitializeWizard(); +begin + if VCRedistNeedsInstall then begin + idpAddFile('http://download.microsoft.com/download/9/a/2/9a2a7e36-a8af-46c0-8a78-a5eb111eefe2/vc_redist.x86.exe', ExpandConstant('{tmp}\vc_redist.x86.exe')); + + idpDownloadAfter(wpReady); + end +end; + procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then RunPreviousVersionUninstaller(); - if CurStep = ssPostInstall then + if CurStep = ssPostInstall then begin SetLootLanguage(); + DeleteFile(ExpandConstant('{tmp}\vc_redist.x86.exe')); + end end;