I want to include a file from program files\my org\my app in an Inno Setup install. The file actually lives in c:\program files (x86)\my org\my app but I would like to be able to compile the setup on 32 and 64 bit versions of Windows so I would like to use a constant as part of the source file names:
[Files]
Source: "{pf}\my org\my app\myapp.exe"; DestDir: "{app}"
Inno setup just treats the {pf} literally and I get a message saying it can't find the file "{pf}\my org\my app\myapp.exe"
In the help it says you can only use constants for the source file if the external flag is used but this only works for files that already exist on the target system.
There is another similar question that suggests that you can use constants in the source file name but I can't get this to work:
How to use parent of a directory in a Source parameter of the Files section?
I also tried setting:
[Setup]
SourceDir={pf}\my org\my app
but again the compiler treats the {pf} as literal text rather than replacing it, unlike DefaultDirName where constants are replaced.
I'm using Inno Setup version 5.5.3 (a).
Any ideas?
{pf}constant is expanded at runtime, not at compilation time, so you're out of luck with this approach. Preprocessor has declared only variable for Windows folder, but well, you could read the path to Program Files somewhere from the registry which is, uhm, crazy. If I were you, I would make a subfolder e.g.Deployand there put the setup script. Then you can reach your files with relative paths which is much better than hoping them to be in a certain Program Files folder. Besides, Program Files folder is not a good folder for deployment... - TLamaSourceparameter norSourceDirdirective. For instanceSourceparameter value must be known after preprocessing (before the compilation starts) if you don't specifyexternalflag. In short, you cannot do what you want other way than using preprocessor. - TLama