function ExpandFileNameCase(const FileName: AnsiString; out MatchFound: TFilenameCaseMatch): AnsiString;
extern DELPHI_PACKAGE System::AnsiString __fastcall ExpandFileNameCase(const System::AnsiString FileName, /* out */ TFilenameCaseMatch &MatchFound)/* overload */;
Get fully qualified filename by performing case-insensitive filename search looking for a close match.
ExpandFileNameCase returns a fully qualified filename like ExpandFileName, but performs a case-insensitive filename search looking for a close match in the actual file system, differing only in uppercase versus lowercase of the letters. This is useful to convert user input into usable file names or to convert filename data created on a case-insensitive file system (such as Windows) to something usable on a case-sensitive file system (such as Linux).
The MatchFound out parameter indicates what kind of match was found in the file system and what the function result is based upon (in order of increasing difficulty or complexity):
- mkExactMatch: Case-sensitive match. Result is ExpandFileName(FileName).
- mkSingleMatch: Exactly one file in the given directory path matches the given filename on a case-insensitive basis. Returns ExpandFileName(FileName as found in file system).
- mkAmbiguous: More than one file in the given directory path matches the given filename case-insensitively. In many cases, this should be considered an error. Result is ExpandFileName(First matching filename found).
- mkNone: File not found at all. Returns ExpandFileName(FileName).
Note: Since this function searches the file system, it may be much slower than ExpandFileName, particularly when the given filename is ambiguous or does not exist. Use ExpandFileNameCase only when you have a filename of dubious origin (such as from user input) and you want to make a best guess before failing.