Browse Source

fix bug #902 for win32 and linux

pierre 25 years ago
parent
commit
60ed425f24
2 changed files with 32 additions and 5 deletions
  1. 11 3
      rtl/linux/dos.pp
  2. 21 2
      rtl/win32/dos.pp

+ 11 - 3
rtl/linux/dos.pp

@@ -708,8 +708,13 @@ End;
 
 
 Function FSearch(path : pathstr;dirlist : string) : pathstr;
+Var
+  info:stat;
 Begin
-  FSearch:=Linux.FSearch(path,dirlist);
+  if FStat(path,info) then
+    FSearch:=path
+  else
+    FSearch:=Linux.FSearch(path,dirlist);
 End;
 
 
@@ -909,7 +914,10 @@ End.
 
 {
   $Log$
-  Revision 1.19  2000-03-19 18:48:19  peter
+  Revision 1.20  2000-04-17 20:43:27  pierre
+   fix bug 902 for win32 and linux
+
+  Revision 1.19  2000/03/19 18:48:19  peter
     * dosexitcode finally works correct
 
   Revision 1.18  2000/03/16 15:23:02  marco
@@ -938,4 +946,4 @@ End.
   Revision 1.11  1999/07/24 11:18:11  peter
     * fixed getfattr which didn't reset doserror
 
-}
+}

+ 21 - 2
rtl/win32/dos.pp

@@ -544,6 +544,14 @@ begin
   S[L]:=#0;
 end;
 
+Procedure PCharToString (Var S : String);
+Var L : Longint;
+begin
+  L:=strlen(pchar(@S[0]));
+  Move (S[0],S[1],L);
+  S[0]:=char(l);
+end;
+
 
 procedure FindMatch(var f:searchrec);
 begin
@@ -717,6 +725,14 @@ begin
   StringToPchar(name);
   StringToPchar(ext);
 
+  StringToPchar(dir);
+  if SearchPath(@dir, @name, @ext, 255, @value, temp)>0 then
+    begin
+      fsearch := strpas(value);
+      exit;
+    end;
+  PCharToString(dir);
+
   repeat
     i:=pos(';',dirlist);
     while i=1 do
@@ -934,7 +950,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.34  2000-02-26 13:24:26  peter
+  Revision 1.35  2000-04-17 20:43:27  pierre
+   fix bug 902 for win32 and linux
+
+  Revision 1.34  2000/02/26 13:24:26  peter
     * fixed fexpand with empty argument to return current dir
 
   Revision 1.33  2000/02/09 16:59:34  peter
@@ -985,4 +1004,4 @@ end.
   Revision 1.18  1999/08/12 09:24:14  michael
   Fixed win32finddata size; searchrec.excludeattr was overwritten.
 
-}
+}