Girish Chandran C
Girish Chandran C

Reputation: 111

Get the path specified in the source of file section

Is there any way by which we can get the path of the source file in [file] section be made available in [code] section. I need to have the full path as been given in the source. I need to check it with the content of a file and if the path is present in the file, then only i need to copy that particular file. I am using Check: in the file section and need to have the whole path of file made available in code section for comparison.

Upvotes: 1

Views: 1137

Answers (2)

Deanna
Deanna

Reputation: 24283

Probably the CurrentFileName() function that:

Returns the destination name of the [Files] entry that is currently being processed.

You can probably work out the source from this. I'm not sure how it handles wildcards though (but I suspect it just returns "blah/*"

Upvotes: 0

Nyerguds
Nyerguds

Reputation: 5639

To get the chosen install folder from pascal script, you can use either ExpandConstant('{app}') or WizardDirValue(). Note that I don't think the returned path contains a trailing backslash.

This would simply check a file existence:

function IsMyFilePresent: Boolean;
begin
    Result:=FileExists(ExpandConstant('{app}\filename.ext'));
end;

If it's an ini file, you can use this code to retrieve the data of certain keys inside it:

(example using WizardDirValue())

inifile:=WizardDirValue()+'\filename.ext';
MyString:=GetIniString('SectionName', 'KeyName', 'DefaultValue', inifile);

Upvotes: 1

Related Questions