Reputation: 1131
I need to add idl virtual machine to my Target location for my IDL .sav file I am using Inno Setup, And the following code lines
[Icons]
Name: "{group}\clas"; Filename: "{code:GetIDLPath}"; Parameters: """{app}\bin\BATCH_CLAS_MAIN.sav"""; IconFilename: "{app}\clas_icon.ico"
[Code]
function GetIDLPath(dummy: string): string;
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\idlrt.exe', '', Result);
if Result = '' then
Result := 'idlrt.exe';
end;
But the Target location end up being:
C:\clas\bin\BATCH_CLAS_MAIN.sav
It should be:
"C:\Program Files\Exelis\IDL82\bin\bin.x86\idlrt.exe" -vm C:/clas/bin/BATCH_CLAS_MAIN.sav
I checked the idlrt.exe location in registry and I am providing the correct path,
Does anyone know what’s wrong?
Upvotes: 1
Views: 1246
Reputation: 76693
At least I can see something wrong with the Parameters
parameter value. You can't get the expected result with -vm
option followed by the {app}/bin/BATCH_CLAS_MAIN.sav
path with forward slashes if you pass an expandable "{app}\bin\BATCH_CLAS_MAIN.sav"
constant. This might be better a bit:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName=My Program
[Icons]
; because of use of the "useapppaths" flag, there's no need to have the
; GetIDLPath function anymore; that flag do its work for you
Name: "{group}\clas"; Filename: "idlrt.exe"; Parameters: "{code:GetIDLParams}"; IconFilename: "{app}\clas_icon.ico"; Flags: useapppaths
[Code]
function GetIDLParams(Value: string): string;
begin
// prepare the -vm option followed by a quoted application path to a file
Result := '-vm ' + AddQuotes(ExpandConstant('{app}\bin\BATCH_CLAS_MAIN.sav'));
// and replace backslashes to forward slashes
StringChangeEx(Result, '\', '/', False);
end;
Upvotes: 1