[Overview][Types][Classes][Procedures and functions][Index] Reference for unit 'ShellCtrls' (#lcl)

TCustomShellTreeView.GetFilesInDir

Fills a TStrings instance with file system objects which match the specified path and mask.

Declaration

Source position: shellctrls.pas line 127

public class procedure TCustomShellTreeView.GetFilesInDir(

  const ABaseDir: string;

  AMask: string;

  AObjectTypes: TObjectTypes;

  AResult: TStrings;

  AFileSortType: TFileSortType = fstNone;

  ACaseSensitivity: TMaskCaseSensitivity = mcsPlatformDefault

);

Arguments

ABaseDir

  

Base directory name used to resolve relative path references in AMask.

AMask

  

One or more mask values used to select the matching file system objects returned in AResult.

AObjectTypes

  

Specifies the file system object types examined and returned in AResult.

AResult

  

TStrings instance where file system objects matching the specified criteria are stored and returned.

AFileSortType

  

Sort type/order applied to the file system objects in AResult.

ACaseSensitivity

  

Indicates whether case sensitivity is used when file system objects are compared to the selection criteria.

Description

GetFilesInDir is a class method which can be called without an existing instance of a TCustomShellTreeView descendant. For example:

TShellTreeView.GetFilesInDir('/path/to/dir', '*.pas;*.pp', 
  [otNonFolders], AStringList, [fstAlphabet], mcsCaseSensitive);

It performs actions to gather directories and/or files as in the PopulateTreeNodeWithFiles method, but does not store the file system objects to the Items property.

GetFilesInDir calls an implementation routine to access the local file system and to store matching file system objects in AResult. It calls FindFirstUTF8 / FindNextUTF8 / FindCloseUTF8 (in LazUtils) to gather TSearchRec information for the folders or files which match the specified criteria. The file system information is transferred to TFileItem instances which are stored in the Objects property in AResult. The Names property in AResult contains the names for the directories or files.

Use ABaseDir to specify the folder examined in the method, and the base directory used to resolve any relative path references in AMask. A trailing path delimiter is not required in ABaseDir; it is appended (when needed) in the implementation.

Use AMask to specify one or masks for file system items considered a match in the method. Use the ';' character to delimit mask values in the argument. When omitted (or set to an empty string), the AllFilesMask ('*') is used when checking file system objects.

Use AObjectTypes to specify the file system objects examined in the method. See TObjectType for the values allowed in the set type, and their meanings.

AResult is a TStrings instance where folders and/or files matching the specified criteria are stored and returned to the caller. Use the Names property in AResult to access the names for the file system objects in the list. Use the Objects property in AResult to access TFileItem instances with the path and search record information for the file system objects. A value in Object must be cast to a TFileItem type to access the properties specific to the object instance. Use the Clear method in AResult to free the Names and Objects in the TStrings instance.

Use AFileSortType to specify the sort order applied to the values stored in AResult. See TFileSortType for the values allowed in the argument, and their meanings.

Use ACaseSensitivity to specify whether case sensitivity is used when comparing values in AMask to select matching file system objects. See TMaskCaseSensitivity for the values allowed in the argument, and their meanings. The default value for the argument is mcsPlatformDefault in the implementation routine.

Version info

Modified in LCL version 3.0 to have public visibility.

See also

TCustomShellTreeView.Items

  

Contains the tree nodes used to represent the hierarchical tree structure for the tree view control.

TCustomShellTreeView.PopulateTreeNodeWithFiles

  

Adds tree nodes for file system objects found starting at the specified node / path.

TFileItem

  

Provides information about a file or directory on the local file system for use in file sort comparison routines.

TFileSortType

  

Represents sorting options for the items in a shell control.

TMaskCaseSensitivity

  

Represents case sensitivity options for file masks.

TObjectType

  

Indicates which objects should be visible in a Shell control.

TObjectTypes

  

Set type with values that indicate the visible objects in a Shell control.

FindFirstUTF8

FindNextUTF8

FindCloseUTF8

TMaskList

TSearchRec


Version 4.0 Generated 2025-05-03 Home