Bladeren bron

Merged revisions 12381 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r12381 | hajny | 2008-12-17 22:58:33 +0000 (Wed, 17 Dec 2008) | 1 line

* extended fix for web bug #12370 (more platforms supported and slightly more universal)
........

git-svn-id: branches/fixes_2_2@12682 -

Tomas Hajny 16 jaren geleden
bovenliggende
commit
2d3c1d0667
1 gewijzigde bestanden met toevoegingen van 21 en 5 verwijderingen
  1. 21 5
      compiler/cfileutils.pas

+ 21 - 5
compiler/cfileutils.pas

@@ -463,17 +463,33 @@ implementation
      begin
         result:=false;
 {$if defined(unix)}
-        if (length(s)>0) and (s[1]='/') then
+        if (length(s)>0) and (s[1] in AllowDirectorySeparators) then
           result:=true;
 {$elseif defined(amiga) or defined(morphos)}
-        if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
+        if ((length(s)>0) and (s[1] in AllowDirectorySeparators)) or (Pos(':',s) = length(s)) then
           result:=true;
 {$elseif defined(macos)}
         if IsMacFullPath(s) then
           result:=true;
-{$elseif defined(win32) or defined(win64) or defined(go32v2)}
-        if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
-           ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
+{$elseif defined(netware)}
+        if (Pos (DriveSeparator, S) <> 0) or
+                ((Length (S) > 0) and (S [1] in AllowDirectorySeparators)) then
+          result:=true;
+{$elseif defined(win32) or defined(win64) or defined(go32v2) or defined(os2) or defined(watcom)}
+        if ((length(s)>0) and (s[1] in AllowDirectorySeparators)) or
+(* The following check for non-empty AllowDriveSeparators assumes that all
+   other platforms supporting drives and not handled as exceptions above
+   should work with DOS-like paths, i.e. use absolute paths with one letter
+   for drive followed by path separator *)
+           ((length(s)>2) and (s[2] in AllowDriveSeparators) and (s[3] in AllowDirectorySeparators)) then
+          result:=true;
+{$else}
+        if ((length(s)>0) and (s[1] in AllowDirectorySeparators)) or
+(* The following check for non-empty AllowDriveSeparators assumes that all
+   other platforms supporting drives and not handled as exceptions above
+   should work with DOS-like paths, i.e. use absolute paths with one letter
+   for drive followed by path separator *)
+           ((AllowDriveSeparators <> []) and (length(s)>2) and (s[2] in AllowDriveSeparators) and (s[3] in AllowDirectorySeparators)) then
           result:=true;
 {$endif unix}
      end;