Browse Source

* committed Tomas' patch

git-svn-id: branches/fixes_2_6@26668 -
marco 11 years ago
parent
commit
3e1b2d8ed3
2 changed files with 18 additions and 2 deletions
  1. 14 2
      rtl/emx/sysdir.inc
  2. 4 0
      rtl/os2/sysdir.inc

+ 14 - 2
rtl/emx/sysdir.inc

@@ -112,6 +112,8 @@ begin
        if Len > 2 then
         begin
          DoDirSeparators (S);
+         if (S [Pred (Len)] = DirectorySeparator) and (Len <> 3) then
+          S [Pred (Len)] := #0;
          RC := DosSetCurrentDir (S);
          if RC <> 0 then
           begin
@@ -123,6 +125,8 @@ begin
     else
      begin
       DoDirSeparators (S);
+      if (Len > 1) and (S [Pred (Len)] = DirectorySeparator) then
+       S [Pred (Len)] := #0;
       RC := DosSetCurrentDir (S);
       if RC <> 0 then
        begin
@@ -150,14 +154,22 @@ begin
 @LCHDIR:
      end ['eax','edx','esi'];
      if (Len > 2) and (InOutRes <> 0) then
+      begin
+       if (S [Pred (Len)] in AllowDirectorySeparators) and (Len <> 3) then
+        S [Pred (Len)] := #0;
       { Under EMX 0.9d DOS this routine may sometime }
       { fail or crash the system.                    }
-      DosDir ($3B, S);
+       DosDir ($3B, S);
+      end;
     end
    else
+    begin
+     if (Len > 1) and (S [Pred (Len)] in AllowDirectorySeparators) then
+      S [Pred (Len)] := #0;
     { Under EMX 0.9d DOS this routine may sometime }
     { fail or crash the system.                    }
-    DosDir ($3B, S);
+     DosDir ($3B, S);
+    end;
 end;
 
 

+ 4 - 0
rtl/os2/sysdir.inc

@@ -69,6 +69,8 @@ begin
       if Len > 2 then
       begin
         DoDirSeparators (s);
+        if (S [Pred (Len)] = DirectorySeparator) and (Len <> 3) then
+         S [Pred (Len)] := #0;
         RC := DosSetCurrentDir (s);
         if RC <> 0 then
         begin
@@ -78,6 +80,8 @@ begin
       end;
   end else begin
     DoDirSeparators (s);
+    if (Len > 1) and (S [Pred (Len)] = DirectorySeparator) then
+     S [Pred (Len)] := #0;
     RC := DosSetCurrentDir (s);
     if RC <> 0 then
     begin