On Wed, Sep 25, 2019 at 7:33 AM Anthony Walter via lazarus <[email protected]> wrote:
> The File Search utility is a stand alone tool for Mac, Windows, and Linux to > search for files using a variety of criteria including containing text, file > size, > and file dates. First of all: NICE! You asked foor feedback. You search the entire folder for each pattern in a loop (e.g. 10 patterns, 10 times a FindFirst/FindNext loop).. Then you see if a given match already is in the list (with IndexOf, whic will be slow if you have lots of items). An alternative would be to use a TMaskList and use it's MatchesMaks method (and search the folder with AllFilesMaks). This way you can be sure no double entries will be found. If the count of patterns is 1, then an optimization could be to not use a TMaskList but let the OS do the filtering with FindFirst/FindNext. Using a TMaskList offers you the possibility to let the user decide wether the patterns are case-sensitive. AFAICS, then as it is now, patterns are case-sensitive on *nix systems. This makes finding e.g. all JPEG's a bit awkward on those platforms (you would have to specify each and every possible mix of uppercase and lowercase spelling of '*.jpg;*.jpeg'). I recently adapted TShellTreeView/TShellTreeView to do it like that. (Previously it used a TAvlTree for this purpos, which is faster when searching than a TStringList) -- Bart -- _______________________________________________ lazarus mailing list [email protected] https://lists.lazarus-ide.org/listinfo/lazarus
