How can I determine whether a certain file exists in the same location where Setup.exe is running from?
i.e. something like this:
if (FileExists(App.Path + '\config_file*.txt') = True) then
Note: I don't want to know the folder into which the application is being installed, I want to know the folder from which Setup.exe
is running (eg. "C:\Documents and Settings\Jennifer Cox") - in Visual Basic
For example the equivalent of App.Path.
To get the path from where the setup was executed you need to extract it from the {srcexe}
constant. To extract the path from a file you can use the ExtractFilePath
function so putting this together you can get something like this:
var
S: string;
begin
S := AddBackslash(ExtractFilePath(ExpandConstant('{srcexe}'))) + 'File.txt');
if FileExists(S) then
...
end;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments