1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-13 08:34:08 +02:00

Make update installer use TweetDuck's initial command line arguments

This commit is contained in:
chylex 2016-11-23 03:20:38 +01:00
parent 391a90e1df
commit 84fb1c5b2b
2 changed files with 12 additions and 5 deletions

View File

@ -163,9 +163,10 @@ private static void Main(){
if (mainForm.UpdateInstallerPath != null){
ExitCleanup();
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+GetArgsClean().ToString().Replace("\"", "\\\"")+"\""+(IsPortable ? " /PORTABLE=1" : "");
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\""+(IsPortable ? " /PORTABLE=1" : ""), runElevated); // ProgramPath has a trailing backslash
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated); // ProgramPath has a trailing backslash
Application.Exit();
}
}
@ -212,6 +213,12 @@ public static void ResetConfig(){
ReloadConfig();
}
private static CommandLineArgs GetArgsClean(){
CommandLineArgs args = Args.Clone();
args.RemoveFlag("-importcookies");
return args;
}
public static void Restart(){
Restart(new string[0]);
}
@ -223,9 +230,8 @@ public static void Restart(string[] extraArgs){
return;
}
CommandLineArgs args = Args.Clone();
CommandLineArgs args = GetArgsClean();
args.AddFlag("-restart");
args.RemoveFlag("-importcookies");
CommandLineArgs.ReadStringArray('-', extraArgs, args);

View File

@ -47,7 +47,7 @@ Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesu
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: TDIsUninstallable
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall shellexec
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Parameters: "{param:RUNARGS}"; Flags: nowait postinstall shellexec
[InstallDelete]
Type: files; Name: "{app}\*.xml"
@ -242,7 +242,8 @@ begin
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if Exec(InstallFile, '/SP- /SILENT /MERGETASKS="!desktopicon" /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
if Exec(InstallFile, '/SP- /SILENT /MERGETASKS="!desktopicon" /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
if ResultCode <> 0 then
begin
DeleteFile(InstallFile);