1

Overview

My install process involves placing over 2GB of data on a disk. So I use Inno Setup, but I run 7ZIP to actually extract/install the files.

Issue

The issue I have is that it seems the desktop icon is being created before the [Run] section, so there is no icon to set the the desktop link. Is there a way around this? (I have tried both {src} and {app} as the folder to find the icon.)

CODE

[Run]
Filename: "{pf64}\7-zip\7zG.exe"; Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
  Flags: runascurrentuser

[Icons]
Name: "{group}\EGPL Watson Uninstall"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
Name: "{commondesktop}\DashBoard"; \
  Filename: "{app}\dashboard\node_modules\electron\dist\electron.exe"; \
  WorkingDir: "{app}\dashboard"; IconFilename: "{src}\dashboard\build\configure.ico"; \
  Parameters: "main.js"; AfterInstall: SetElevationBit('{commondesktop}\DashBoard.lnk')
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Dr.YSG
  • 7,171
  • 22
  • 81
  • 139

1 Answers1

4

A quick and dirty solution is to set ChangesAssociations:

[Setup]
ChangesAssociations=yes

It makes Windows Explorer refresh all icons after the installer finishes.


A clean solution is to create the icon only after the [Run] section using CreateShellLink:

[Run]
Filename: "{pf64}\7-zip\7zG.exe"; \
    Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
    Flags: runascurrentuser; AfterInstall: CreateIcon
[Code]

procedure CreateIcon;
var
  IconFileName: string;
begin
  IconFileName := ExpandConstant('{commondesktop}\DashBoard.lnk');

  CreateShellLink(
    IconFileName, '',
    ExpandConstant('{app}\dashboard\node_modules\electron\dist\electron.exe'),
    'main.js', ExpandConstant('{app}\dashboard'),
    ExpandContant('{app}\dashboard\build\configure.ico'), 0, SW_SHOWNORMAL);

  SetElevationBit(IconFileName);
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992