Skip to content

Commit

Permalink
Build update manifest change
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefNemec committed Oct 18, 2018
1 parent 3a0159e commit c1a38f6
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 3 deletions.
149 changes: 149 additions & 0 deletions build/InnoSetupUpdate.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#define MyAppName "Playnite"
#define MyAppVersion "{version}"
#define MyAppPublisher "Josef Nemec"
#define MyAppURL "https://playnite.link"
#define MyAppExeName "PlayniteUI.exe"
#define SourcePath "{source_path}"
#define PlayniteAppMutex = "PlayniteInstaceMutex"

[Setup]
AppId={#MyAppName}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppMutex={#PlayniteAppMutex}
DefaultDirName={localappdata}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir="{out_dir}"
OutputBaseFilename="{out_file_name}"
SetupIconFile=..\source\PlayniteUI\Images\applogo.ico
Compression=lzma2/max
CompressionThreads=4
LZMANumBlockThreads=4
SolidCompression=yes
PrivilegesRequired=admin
VersionInfoVersion={#MyAppVersion}
VersionInfoCompany={#MyAppPublisher}
VersionInfoCopyright={#MyAppPublisher}
UsePreviousAppDir=yes
DisableDirPage=no
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
CloseApplications=yes
Uninstallable=GetCreateUninstaller()

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
Name: "startmenu"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: "{#SourcePath}\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs; Excludes: "*.log"

[Icons]
Name: "{userappdata}\Microsoft\Windows\Start Menu\Programs\Playnite\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: startmenu; Check: GetCreateIcons
Name: "{userappdata}\Microsoft\Windows\Start Menu\Programs\Playnite\Uninstall"; Filename: "{uninstallexe}"; Tasks: startmenu; Check: GetCreateIcons
Name: "{commondesktop}\Playnite"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; Check: GetCreateIcons

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "Launch Playnite"; Flags: nowait postinstall shellexec

[Code]
var
CreateIcons: Boolean;
CreateInstaller: Boolean;
function GetCreateUninstaller(): Boolean;
begin
Result := CreateInstaller;
end;
function GetCreateIcons(): Boolean;
begin
Result := CreateIcons;
end;
function CmdLineParamExists(const Value: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ParamCount do
if CompareText(ParamStr(I), Value) = 0 then
begin
Result := True;
Break;
end;
end;
function InitializeSetup : Boolean;
begin
Result := True;
CreateIcons := True;
CreateInstaller := True;
{ Don't create installer if running in portable mode }
if (CmdLineParamExists('/PORTABLE') = true) then
begin
CreateInstaller := False;
CreateIcons := False;
end;
{ Don't re-create icons when updating, user might delete them }
if (CmdLineParamExists('/UPDATE') = true) then
begin
CreateIcons := False;
{ Wait for Playnite process to shutdown first. }
while CheckForMutexes('{#PlayniteAppMutex}') = true do
begin
Sleep(300);
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
UninstallerPath, UninstallerLogPath, UninstallRegKey, WinmdReferencePath, SdkPath: string;
begin
if CurStep = ssPostInstall then
begin
{ Cleanup old NSIS files and registry keys }
UninstallerPath := ExpandConstant('{app}\uninstall.exe');
UninstallerLogPath := ExpandConstant('{app}\uninstall.log');
UninstallRegKey := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Playnite';
WinmdReferencePath := ExpandConstant('{app}\Windows.winmd');
SdkPath := ExpandConstant('{app}\PlayniteSDK.dll');
if FileExists(SdkPath) = true then
begin
DeleteFile(SdkPath);
end;
if FileExists(WinmdReferencePath) = true then
begin
DeleteFile(WinmdReferencePath);
end;
if FileExists(UninstallerPath) = true then
begin
DeleteFile(UninstallerPath);
end;
if FileExists(UninstallerLogPath) = true then
begin
DeleteFile(UninstallerLogPath);
end;
if RegKeyExists(HKEY_LOCAL_MACHINE, UninstallRegKey) = true then
begin
RegDeleteKeyIncludingSubkeys(HKEY_LOCAL_MACHINE, UninstallRegKey);
end;
end;
end;
12 changes: 9 additions & 3 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,20 @@ function BuildInnoInstaller()
[Parameter(Mandatory = $true)]
[string]$DestinationFile,
[Parameter(Mandatory = $true)]
[string]$Version
[string]$Version,
[Parameter(Mandatory = $false)]
[switch]$Update = $false
)

$innoCompiler = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe"
$innoScript = "InnoSetup.iss"
$innoScript = "InnoSetup.iss"
$innoTempScript = "InnoSetup.temp.iss"
$destinationExe = Split-Path $DestinationFile -Leaf
$destinationDir = Split-Path $DestinationFile -Parent
if ($Update)
{
$innoScript = "InnoSetupUpdate.iss"
}

Write-OperationLog "Building Inno Setup $destinationExe..."
New-Folder $destinationDir
Expand Down Expand Up @@ -234,7 +240,7 @@ if ($UpdateDiffs)
CreateDirectoryDiff (Join-Path $BuildsStorageDir $diffVersion) $OutputDir $diffDir

$installerPath = Join-Path $InstallerDir "$diffString.exe"
BuildInnoInstaller $diffDir $installerPath $buildNumber
BuildInnoInstaller $diffDir $installerPath $buildNumber -Update
Remove-Item $diffDir -Recurse -Force

if ($Sign)
Expand Down

0 comments on commit c1a38f6

Please sign in to comment.