Unit CastleFindFiles
Description
Finding files matching some mask.
Source: files/castlefindfiles.pas (line 17).
Uses
- SysUtils
- Classes
- Generics.Collections
- DOM
- CastleUtils
Overview
Classes, Interfaces, Objects and Records
| Name | Description |
|---|---|
Record TFileInfo |
Information about a single file or directory collected by FindFiles. |
Class TFileInfoList |
Returned by FindFilesList. |
Functions and Procedures
function FindFiles(const Path, Mask: string; const FindDirectories: boolean; const FileMethod: TFoundFileMethod; const Options: TFindFilesOptions): Cardinal; overload; |
function FindFiles(const Path, Mask: string; const FindDirectories: boolean; const FileProc: TFoundFileProc; const FileProcData: Pointer; const Options: TFindFilesOptions): Cardinal; overload; |
function FindFiles(const PathAndMask: string; const FindDirectories: boolean; const FileMethod: TFoundFileMethod; const Options: TFindFilesOptions): Cardinal; overload; |
function FindFiles(const PathAndMask: string; const FindDirectories: boolean; const FileProc: TFoundFileProc; const FileProcData: Pointer; const Options: TFindFilesOptions): Cardinal; overload; |
function FindFilesList(const Path, Mask: string; const FindDirectories: boolean; const Options: TFindFilesOptions): TFileInfoList; overload; |
function FindFilesList(const PathAndMask: string; const FindDirectories: boolean; const Options: TFindFilesOptions): TFileInfoList; overload; |
function SearchFileHard(Path: string; const Base: string; out NewBase: string): boolean; |
function FindFirstFile(const Path, Mask: string; const FindDirectories: boolean; const Options: TFindFilesOptions; out FileInfo: TFileInfo): boolean; |
function FindFirstFileIgnoreCase(const Path, Mask: string; const FindDirectories: boolean; const Options: TFindFilesOptions; out FileInfo: TFileInfo): boolean; |
procedure SplitPathAndMask(const PathAndMask: String; out Path, Mask: String); |
Types
TFoundFileProc = procedure (const FileInfo: TFileInfo; Data: Pointer; var StopSearch: Boolean); |
TFoundFileMethod = procedure (const FileInfo: TFileInfo; var StopSearch: Boolean) of object; |
TFindFilesOption = (...); |
TFindFilesOptions = set of TFindFilesOption; |
Description
Functions and Procedures
function FindFiles(const Path, Mask: string; const FindDirectories: boolean; const FileMethod: TFoundFileMethod; const Options: TFindFilesOptions): Cardinal; overload; |
|
Find all files matching the given mask, and call FileProc for them.
Parameters
ReturnsHow many times FileProc was called, that is: how many files/directories were matching. Useful to report to user how many files were processed, in particular to warn if nothing was processed. |
function FindFiles(const Path, Mask: string; const FindDirectories: boolean; const FileProc: TFoundFileProc; const FileProcData: Pointer; const Options: TFindFilesOptions): Cardinal; overload; |
|
This item has no description. |
function FindFiles(const PathAndMask: string; const FindDirectories: boolean; const FileMethod: TFoundFileMethod; const Options: TFindFilesOptions): Cardinal; overload; |
|
This item has no description. |
function FindFiles(const PathAndMask: string; const FindDirectories: boolean; const FileProc: TFoundFileProc; const FileProcData: Pointer; const Options: TFindFilesOptions): Cardinal; overload; |
|
This item has no description. |
function FindFilesList(const Path, Mask: string; const FindDirectories: boolean; const Options: TFindFilesOptions): TFileInfoList; overload; |
|
Like FindFiles, but return found files as a list. Caller is responsible for freeing the returned list. |
function FindFilesList(const PathAndMask: string; const FindDirectories: boolean; const Options: TFindFilesOptions): TFileInfoList; overload; |
|
This item has no description. |
function SearchFileHard(Path: string; const Base: string; out NewBase: string): boolean; |
|
Search for a file, ignoring the case. Path must be absolute URL and contain the final slash. Returns URL relative to Path. We prefer to return just Base, if it exists, or when no alternative exists. When Base doesn't exist but some likely alternative exists (e.g. with different case), we return it. Looks for normal files/symlinks, that can be opened as usual files. Not directories. Returns if some file was found. Note that even when we return |
function FindFirstFile(const Path, Mask: string; const FindDirectories: boolean; const Options: TFindFilesOptions; out FileInfo: TFileInfo): boolean; |
|
Find first file matching given Mask inside Path. If found, returns |
function FindFirstFileIgnoreCase(const Path, Mask: string; const FindDirectories: boolean; const Options: TFindFilesOptions; out FileInfo: TFileInfo): boolean; |
|
Find first file matching given Mask inside Path, always ignores case (regardless of OS conventions). If found, returns |
procedure SplitPathAndMask(const PathAndMask: String; out Path, Mask: String); |
|
Assuming that PathAndMask is a string containing URL prefix and a filename with wildcard characters * and ?, split into Path and Mask. It is guaranteed that Path+Mask equal exactly PathAndMask. ( This also implies we do no percent-decoding here. ) Note that this doesn't really treat PathAndMask as a full URL: in a real URL, we would treat ? as part of the "query". And ExtractUriName would even strip it. Here we assume ? is part of mask. |
Types
TFoundFileProc = procedure (const FileInfo: TFileInfo; Data: Pointer; var StopSearch: Boolean); |
|
Called for each file found. StopSearch is always initially |
TFoundFileMethod = procedure (const FileInfo: TFileInfo; var StopSearch: Boolean) of object; |
|
This item has no description. |
TFindFilesOption = (...); |
|
This item has no description. Values
|
TFindFilesOptions = set of TFindFilesOption; |
|
This item has no description. |
Generated by PasDoc 1.0.4.