mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-06-01 20:34:07 +02:00
Add portable functionality to update installer
This commit is contained in:
parent
87fd2a521e
commit
b0261342ff
@ -148,7 +148,7 @@ private static void Main(){
|
|||||||
if (mainForm.UpdateInstallerPath != null){
|
if (mainForm.UpdateInstallerPath != null){
|
||||||
ExitCleanup();
|
ExitCleanup();
|
||||||
|
|
||||||
Process.Start(mainForm.UpdateInstallerPath, "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\""); // ProgramPath has a trailing backslash
|
Process.Start(mainForm.UpdateInstallerPath, "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\""+(IsPortable ? " /PORTABLE=1" : "")); // ProgramPath has a trailing backslash
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ OutputBaseFilename={#MyAppName}.Update
|
|||||||
VersionInfoVersion={#MyAppVersion}
|
VersionInfoVersion={#MyAppVersion}
|
||||||
LicenseFile=.\Resources\LICENSE
|
LicenseFile=.\Resources\LICENSE
|
||||||
SetupIconFile=.\Resources\icon.ico
|
SetupIconFile=.\Resources\icon.ico
|
||||||
|
Uninstallable=TDIsUninstallable
|
||||||
UninstallDisplayName={#MyAppName}
|
UninstallDisplayName={#MyAppName}
|
||||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
@ -65,17 +66,20 @@ Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Cache"
|
|||||||
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
|
function TDIsUninstallable: Boolean; forward;
|
||||||
function TDFindUpdatePath: String; forward;
|
function TDFindUpdatePath: String; forward;
|
||||||
function TDGetNetFrameworkVersion: Cardinal; forward;
|
function TDGetNetFrameworkVersion: Cardinal; forward;
|
||||||
function TDGetAppVersionClean: String; forward;
|
function TDGetAppVersionClean: String; forward;
|
||||||
function TDIsMatchingCEFVersion: Boolean; forward;
|
function TDIsMatchingCEFVersion: Boolean; forward;
|
||||||
procedure TDExecuteFullDownload; forward;
|
procedure TDExecuteFullDownload; forward;
|
||||||
|
|
||||||
|
var IsPortable: Boolean;
|
||||||
var UpdatePath: String;
|
var UpdatePath: String;
|
||||||
|
|
||||||
{ Check .NET Framework version on startup, ask user if they want to proceed if older than 4.5.2. Prepare full download package if required. }
|
{ Check .NET Framework version on startup, ask user if they want to proceed if older than 4.5.2. Prepare full download package if required. }
|
||||||
function InitializeSetup: Boolean;
|
function InitializeSetup: Boolean;
|
||||||
begin
|
begin
|
||||||
|
IsPortable := ExpandConstant('{param:PORTABLE}') = '1'
|
||||||
UpdatePath := TDFindUpdatePath()
|
UpdatePath := TDFindUpdatePath()
|
||||||
|
|
||||||
if UpdatePath = '' then
|
if UpdatePath = '' then
|
||||||
@ -143,11 +147,20 @@ begin
|
|||||||
begin
|
begin
|
||||||
TDExecuteFullDownload();
|
TDExecuteFullDownload();
|
||||||
|
|
||||||
DeleteFile(ExpandConstant('{app}\unins000.dat'));
|
if TDIsUninstallable() then
|
||||||
DeleteFile(ExpandConstant('{app}\unins000.exe'));
|
begin
|
||||||
|
DeleteFile(ExpandConstant('{app}\unins000.dat'));
|
||||||
|
DeleteFile(ExpandConstant('{app}\unins000.exe'));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Returns true if the installer should create uninstallation entries (i.e. not running in portable mode). }
|
||||||
|
function TDIsUninstallable: Boolean;
|
||||||
|
begin
|
||||||
|
Result := not IsPortable
|
||||||
|
end;
|
||||||
|
|
||||||
{ Returns a validated installation path (including trailing backslash) using the /UPDATEPATH parameter or installation info in registry. Returns empty string on failure. }
|
{ Returns a validated installation path (including trailing backslash) using the /UPDATEPATH parameter or installation info in registry. Returns empty string on failure. }
|
||||||
function TDFindUpdatePath: String;
|
function TDFindUpdatePath: String;
|
||||||
var Path: String;
|
var Path: String;
|
||||||
@ -155,7 +168,7 @@ var Path: String;
|
|||||||
begin
|
begin
|
||||||
Path := ExpandConstant('{param:UPDATEPATH}')
|
Path := ExpandConstant('{param:UPDATEPATH}')
|
||||||
|
|
||||||
if (Path = '') and not RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppID}}_is1', 'InstallLocation', Path) then
|
if (Path = '') and not IsPortable and not RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppID}}_is1', 'InstallLocation', Path) then
|
||||||
begin
|
begin
|
||||||
Result := ''
|
Result := ''
|
||||||
Exit
|
Exit
|
||||||
|
Loading…
Reference in New Issue
Block a user