I am creating a patch installer using Inno Setup.
After the installation, I want InnoSetup to rename the folder in Program Files (as you can see in the [Code]
section below.
This works fine. But then, at the end of the installation, it prompts if I want to run the app. When yes is selected - it looks for the exe file in the old path. It makes sense because that is what is in the {app}
variable.
So my question, is how can I make the [Run]
section look at the new renamed path?
Please note that I have UsePreviousAppDir=yes
set to true and should stay set to true.
Here are related parameters for my InnoSetup:
[Setup]
UsePreviousAppDir=yes
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
{ ///////////////////////////////////////////////////////////////////// }
procedure InitializeWizard();
begin
RenameFile(ExpandConstant('{app}'), ExpandConstant('..\{app}') + ExpandConstant('{#MyAppName}') + ' ' + ExpandConstant('{#MyAppVersion}'))
end;
Managed to make it work now.
[Run]
Filename: "{app}\..\{#MyAppName} {#MyAppVersion}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
{ ///////////////////////////////////////////////////////////////////// }
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssPostInstall) then
begin
RenameFile(ExpandConstant('{app}'), ExpandConstant('{app}\..\{#MyAppName} {#MyAppVersion}'))
end;
end;