[Overview][Constants][Types][Classes][Procedures and functions][Index] |
Checks whether the specified file name shares the path specified in Directory.
Source position: fileutil.pas line 66
function FileIsInDirectory( |
const Filename: string; |
const Directory: string |
):Boolean; |
Filename |
|
The name of the file to be checked. |
Directory |
|
The name of the directory compared to the file name. |
Returns True if the file and directory share the same paths.
FileIsInDirectory is a Boolean function used to determine whether the file in FileName is located in Directory. FileIsInDirectory calls the CleanAndExpandFilename and CleanAndExpandDirectory routines to resolve drive letters or relative path information included in the arguments.
The return value is True when the resolved paths for the arguments contain the same values. FileIsInDirectory does not verify whether Directory or FileName actually exist on the local file system. It compares the specified string values only.
Use DirectoryExists or DirectoryExistsUTF8 to determine whether a path exists on the local file system.
Use FileExists or FileExistsUTF8 to determine whether a file exists on the local file system.
Example:
// uses FileUtil; // ... // var // sDir, sFile: String; // bResult: Boolean; // ... // neither the file nor the directory exist on the file system sDir := 'q:\bogus\path\'; sFile := 'q:\bogus\path\..\path\filename.ext'; bResult := FileIsInDirectory(sFile, sDir); ShowMessage('File: ' + sFile + LineEnding + 'is in Directory: ' + sDir + '?' + LineEnding + 'FileIsInDirectory() result is: ' + bResult.ToString(TUseBoolStrs.True) + '.');
|
Checks whether the specified file name shares the path specified in Path. |
|
|
Removes whitespace and resolves special characters in the specified file name. |
|
|
Removes whitespace and resolves special characters in the specified path. |
|
|
Gets the relative sort order for the specified file names. |
Version 3.2 | Generated 2024-02-25 | Home |