ExpandFileNameCase

Expand a filename entered as case insensitive to the full path as stored on the disk.

Declaration

Source position: finah.inc line 31

  function ExpandFileNameCase(const FileName: UNICODESTRING; 
                             out MatchFound: TFilenameCaseMatch)
                              : UNICODESTRING;
  function ExpandFileNameCase(const FileName: RAWBYTESTRING; 
                             out MatchFound: TFilenameCaseMatch)
                              : RAWBYTESTRING;

Description

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

Name Description
ExpandFileName Expand a relative filename to an absolute filename.
ExtractFileDir Extract the drive and directory part of a filename.
ExtractFileDrive Extract the drive part from a filename.
ExtractFileExt Return the extension from a filename.
ExtractFileName Extract the filename part from a full path filename.
ExtractFilePath Extract the path from a filename.
ExtractRelativePath Extract a relative path from a filename, given a base directory.

Example

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.

results matching ""

    No results matching ""