Browse Source

rtl/amiga: in legacy MatchFirst, revert back to the original directory if we used CurrentDir(0), otherwise MatchFirst() will change the directory to SYS: (0 lock is a shortcut to the boot volume)

Karoly Balogh 3 years ago
parent
commit
27e9377a3a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      rtl/amiga/m68k/legacydos.inc

+ 5 - 1
rtl/amiga/m68k/legacydos.inc

@@ -271,7 +271,11 @@ begin
 
 
   // if no path is given use the current working dir, or try to lock the dir
   // if no path is given use the current working dir, or try to lock the dir
   if Path = '' then
   if Path = '' then
-    DirLock := CurrentDir(0)
+  begin
+    DirLock := CurrentDir(0);
+    if DirLock <> 0 then
+      CurrentDir(DirLock);
+  end
   else
   else
     DirLock := Lock(PChar(Path), ACCESS_READ);
     DirLock := Lock(PChar(Path), ACCESS_READ);
   //
   //