I'm new to Inno Setup, but I want to write some files to the temp directory temporarily, but in a directory structure:
tmp\App.exe
tmp\lic\readme.txt
tmp\cfg\configfile.txt
Code below is only for the tmp\lic\readme.txt file:
[Files]
Source: "\\Mac\Home\Desktop\License\Readme.txt"; Flags: dontcopy
[Code]
function InitializeSetup: Boolean;
begin
if not DirExists(ExpandConstant('{tmp}\lic')) then
CreateDir(ExpandConstant('{tmp}\lic'));
ExtractTemporaryFiles('{tmp}\lic\Readme.txt');
end;
The directory lic is created but I get an error message when extracting the readme.txt file:
Exception: Internal error: ExtractTemporaryFiles: No files matching "{tmp}\lic\Readme.txt" found.
If I do not use the directory lic I do not get this error message.
Is it not possible to temporarily extract a file to a directory in the tmp folder?
The argument of
ExtractTemporaryFilesspecifies the file to extract, not the destination path. You cannot choose the destination path. The file is always extracted directly to{tmp}.See also Extracting files with same name from installer during Inno Setup InitializeSetup
Two approaches you can try:
Move the file using
RenameFile, after you extract it; orExtract the file using
[Files]section, instead of using the code.