|
@@ -451,15 +451,52 @@ End;
|
|
|
--- File ---
|
|
|
******************************************************************************}
|
|
|
|
|
|
-Function FSearch(path : pathstr;dirlist : string) : pathstr;
|
|
|
-{Var
|
|
|
- info : BaseUnix.stat;}
|
|
|
-Begin
|
|
|
-{ if (length(Path)>0) and (path[1]='/') and (fpStat(path,info)>=0) and (not fpS_ISDIR(Info.st_Mode)) then
|
|
|
- FSearch:=path
|
|
|
- else
|
|
|
- FSearch:=Unix.FSearch(path,dirlist);}
|
|
|
-End;
|
|
|
+Function FSearch(path: pathstr; dirlist: string): pathstr;
|
|
|
+var
|
|
|
+ p1 : longint;
|
|
|
+ s : searchrec;
|
|
|
+ newdir : pathstr;
|
|
|
+begin
|
|
|
+ { No wildcards allowed in these things }
|
|
|
+ if (pos('?',path)<>0) or (pos('*',path)<>0) then
|
|
|
+ begin
|
|
|
+ fsearch:='';
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+ { check if the file specified exists }
|
|
|
+ findfirst(path,anyfile and not(directory),s);
|
|
|
+ if doserror=0 then
|
|
|
+ begin
|
|
|
+ findclose(s);
|
|
|
+ fsearch:=path;
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+ findclose(s);
|
|
|
+ //{ allow slash as backslash }
|
|
|
+ //DoDirSeparators(dirlist);
|
|
|
+ repeat
|
|
|
+ p1:=pos(';',dirlist);
|
|
|
+ if p1<>0 then
|
|
|
+ begin
|
|
|
+ newdir:=copy(dirlist,1,p1-1);
|
|
|
+ delete(dirlist,1,p1);
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ newdir:=dirlist;
|
|
|
+ dirlist:='';
|
|
|
+ end;
|
|
|
+ if (newdir<>'') and (not (newdir[length(newdir)] in (AllowDirectorySeparators+[':']))) then
|
|
|
+ newdir:=newdir+DirectorySeparator;
|
|
|
+ findfirst(newdir+path,anyfile and not(directory),s);
|
|
|
+ if doserror=0 then
|
|
|
+ newdir:=newdir+path
|
|
|
+ else
|
|
|
+ newdir:='';
|
|
|
+ findclose(s);
|
|
|
+ until (dirlist='') or (newdir<>'');
|
|
|
+ fsearch:=newdir;
|
|
|
+end;
|
|
|
|
|
|
Procedure GetFAttr(var f; var attr : word);
|
|
|
Var
|