From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function ExpandFileNameCase(const FileName: string; out MatchFound: TFilenameCaseMatch): string;


extern DELPHI_PACKAGE System::UnicodeString __fastcall ExpandFileNameCase(const System::UnicodeString FileName, /* out */ TFilenameCaseMatch &MatchFound)/* overload */;


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Returns the full path name for a relative file name on a case-sensitive file system.

ExpandFileNameCase expands a relative file name into a fully qualified path name, then attempts to find the file or a close case-insensitive match. This is useful when converting file name data from case-insensitive conventions (on Windows) to case-sensitive conventions (on MacOS). It is also useful for validating file names entered by users unfamiliar with MacOS conventions.

FileName is the relative file name to expand.

MatchFound indicates what match, if any, was found for FileName.

The return value is the fully qualified path name generated by ExpandFileNameCase. Its relationship to FileName depends on the value of MatchFound, as indicated in the following table:

MatchFound Return value
mkNone The fully qualified path name, as returned by ExpandFileName.
mkExactMatch The fully qualified path name for the single case-sensitive match to FileName. This is the same value as the one returned when MatchFound is mkNone.
mkSingleMatch (on MacOS) The fully qualified path name for the single file that matches FileName case-insensitively.
mkAmbiguous (on MacOS) The fully qualified path name for one of the case-insensitve matches to FileName. This path name is not the same as the specified file, and not necessarily the closest match.

Note: ExpandFileNameCase is much slower than ExpandFileName, particularly when the specified file name is ambiguous or does not match an actual file.

See Also