[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'sysutils' (#rtl)

ExpandFileNameCase

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

Declaration

Source position: finah.inc line 30

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

ExpandFileName

  

Expand a relative filename to an absolute filename.

ExtractFileName

  

Extract the filename part from a full path filename.

ExtractFilePath

  

Extract the path from a 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.

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.

Documentation generated on: Sep 28 2017