ExpandFileNameCase function
Expand a filename entered as case insensitive to the full path as stored on the disk.
Declaration
function ExpandFileNameCase(const FileName: UnicodeString;
out MatchFound: TFilenameCaseMatch)
: UnicodeStringDescription
On case insensitive platforms, ExpandFileNameCase behaves similarly
to ExpandFileName except for the fact that it returns the final part of the path with
the same case of letters as found on the disk (if it exists - otherwise the case equals
the one provided on input). On case sensitive platforms it also checks whether one or more full
paths exist on disk which would correspond to the provided input if treated case insensitively
and returns the first such match found and information whether the match is unique or not.
Note that the behaviour is basically undefined if the input includes wildcards characters. Normally, wildcards in the last part of path provided on input are resolved to the first corresponding item found on the disk, but it is better not to rely on that and use other more suitable functions if working with wildcards like FindFirst/FindNext.
Errors
None.
See also
- ExpandFileName
- ExtractFileName
- ExtractFilePath
- ExtractFileDir
- ExtractFileDrive
- ExtractFileExt
- ExtractRelativePath
Example: ex33
Program Example33;
{ This program demonstrates the ExpandFileName function }
Uses sysutils;
Procedure Testit (F : String);
begin
Writeln (F,' expands to : ',ExpandFileName(F));
end;
Begin
Testit('ex33.pp');
Testit(ParamStr(0));
Testit('/pp/bin/win32/ppc386');
Testit('\pp\bin\win32\ppc386');
Testit('.');
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
