I've been reading through Inno Setup documentation and got confused about why do we specify the path in ExtractTemporaryFiles function if according to the documentation it extracts the files matching the wildcard specified by Pattern from the [Files] section to a temporary directory.? If we have this Source: "Readme.txt"; Flags: dontcopy in the [Files] section why do we type ExtractTemporaryFiles('{tmp}\Readme.txt') in the [Code] section? Is that a mistake or I just don't understand how this function works? The same applies to the ExtractTemporaryFile procedure.
Here's the code from ExtractTemporyFile page:
[Files]
Source: "Readme.txt"; Flags: dontcopy noencryption
[Code]
function InitializeSetup: Boolean;
var
S: AnsiString;
begin
{ Show the contents of Readme.txt (non Unicode) in a message box }
ExtractTemporaryFile('Readme.txt');
if LoadStringFromFile(ExpandConstant('{tmp}\Readme.txt'), S) then
begin
MsgBox(S, mbInformation, MB_OK);
end;
Result := True;
end;
And here's the code from ExtractTemporaryFiles page:
[Files]
Source: "Readme.txt"; Flags: dontcopy
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
[Code]
function InitializeSetup: Boolean;
var
S: AnsiString;
ResultCode: Integer;
begin
{ Show the contents of Readme.txt (non Unicode) in a message box }
ExtractTemporaryFiles('{tmp}\Readme.txt');
if LoadStringFromFile(ExpandConstant('{tmp}\Readme.txt'), S) then
begin
MsgBox(S, mbInformation, MB_OK);
end;
{ Extract all MyProg files and launch it. Note how {app} is left unexpanded. }
ExtractTemporaryFiles('{app}\MyProg.*');
ExecAsOriginalUser(ExpandConstant('{tmp}\')+'{app}\MyProg.exe', '', '',
SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
Result := True;
end;
In the first case we have:
[Files]
Source: "Readme.txt"; Flags: dontcopy noencryption
[Code]
ExtractTemporaryFile('Readme.txt');
And in the second one we have:
[Files]
Source: "Readme.txt"; Flags: dontcopy
[Code]
ExtractTemporaryFiles('{tmp}\Readme.txt');
What's the difference between those two? (noencryption flag does not count)
Why do we need to specify the {tmp} constant in the second case if we already extracting from there? In order to be able to use those methods correctly I need to have a clear understanding of the syntax.