Browse Source

* fix and cleanup FileSearch

git-svn-id: trunk@10115 -
peter 17 years ago
parent
commit
e08570573f
1 changed files with 10 additions and 10 deletions
  1. 10 10
      rtl/objpas/sysutils/sysutils.inc

+ 10 - 10
rtl/objpas/sysutils/sysutils.inc

@@ -25,11 +25,9 @@
 
     begin
       Result:='';
-      temp:=Dirlist;
+			temp:=SetDirSeparators(DirList);
       repeat
-        While (Length(Temp)>0) and (Temp[1]=PathSeparator) do
-          Delete(Temp,1,1);
-        I:=pos(PathSep,Temp);
+        I:=pos(PathSeparator,Temp);
         If I<>0 then
           begin
             Result:=Copy (Temp,1,i-1);
@@ -40,12 +38,14 @@
             Result:=Temp;
             Temp:='';
           end;
-        If (Length(Result)>0) and (result[length(result)] in AllowDirectorySeparators) then
-          Result:=Result+DirectorySeparator;
-        Result:=Result+name;
-        If not FileExists(Result) Then
-         Result:='';
-      until (length(temp)=0) or (length(result)<>0);
+			  if Result<>'' then
+				  begin		
+            Result:=IncludeTrailingPathDelimiter(Result)+name;
+            If FileExists(Result) Then
+				      exit;
+ 				  end;			
+      until temp='';
+			result:='';
     end;
 
   {$ifndef OS_FILEISREADONLY}