2
votes

I use Inno Setup to create installation files and recently found an issue and I can't see a workaround. My app is not launched directly, it is launched from inside another program, matlab. So my Files and Icons look like this:

[Files]
Source: "include\*"; Excludes: "License"; DestDir: "{app}"; \
    Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\{#MyAppName}"; Filename: matlab; \
    Parameters: "-r ""run '{app}\nCAL\nCAL_RUN.p'"""; IconFilename:"{app}\nCAL.ico";
Name: "{commondesktop}\{#MyAppName}"; Filename: matlab; \
    Parameters: "-r ""run '{app}\nCAL\nCAL_RUN.p'"""; IconFilename:"{app}\nCAL.ico"; \
    Flags: useapppaths

This works fine UNLESS there happens to be a folder called matlab in the Desktop at the time of running Inno Setup compile.

The correct desktop shortcut has these properties:

Target

C:\MATLAB\R2018b\bin\matlab.exe -r "run 'C:\Program Files (x86)\Ricardo\Global DoE Toolkit\nCAL\nCAL_RUN.p'"

Start in

C:\MATLAB\R2018b\bin

However, if by chance there's a (empty or otherwise) folder called matlab on the desktop then the installer creates a shortcut with these properties:

Target

"C:\Users\jse\OneDrive - Ricardo Plc\Desktop\Matlab" -r "run 'C:\Program Files (x86)\Ricardo\Global DoE Toolkit\nCAL\nCAL_RUN.p'"

Start in

"C:\Users\jse\OneDrive - Ricardo Plc\Desktop"

And the shortcut just opens the matlab folder in Explorer.

I can't specify the C:\MATLAB\R2018b\bin\matlab.exe part explicitly because the user could have any version of matlab in any folder. I assume the installer gets the path from the registry.

Any help as to why it falls down and what the fix might be would be much appreciated.

1

1 Answers

1
votes

Use matlab.exe as the shortcut target, to distinguish it from the matlab folder.

Filename: matlab.exe;