FSearch function
Search for file in search path.
Declaration
function FSearch(const path: RawByteString; dirlist: RawByteString;
CurrentDirStrategy: TFSearchOption): RawByteStringDescription
FSearch searches in
DirList, a colon separated list of directories,
for a file named
Path. It then returns a path to the found file.
The CurrentDirStrategy determines how the current directory is treated
when searching:
- NoCurrentDirectory
-
Do not search the current directory unless it is specified in the search path.
- CurrentDirectoryFirst
-
Search the current directory first, before all directories in the search path.
- CurrentDirectoryLast
-
Search the current directory last, after all directories in the search path.
It is mainly provided to mimic DOS search path behaviour. Default behaviour is to search the current directory first.
Errors
An empty string if no such file was found.
See also
Example: ex46
Program Example46;
{ Program to demonstrate the FSearch function. }
Uses BaseUnix, Unix, Strings;
begin
Writeln ('ls is in : ',FSearch ('ls',strpas(fpGetenv('PATH'))));
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
