2
0
Эх сурвалжийг харах

amicommon: merged another AROS branch fix, avoid using GetCurrentDirName in do_GetDir since that doesn't work when started from WB

git-svn-id: trunk@28517 -
Károly Balogh 11 жил өмнө
parent
commit
0a2899573a
1 өөрчлөгдсөн 12 нэмэгдсэн , 9 устгасан
  1. 12 9
      rtl/amicommon/sysdir.inc

+ 12 - 9
rtl/amicommon/sysdir.inc

@@ -84,16 +84,19 @@ begin
 end;
 
 procedure do_GetDir (DriveNr: byte; var Dir: RawByteString);
-var tmpbuf: array[0..255] of char;
+var
+  tmpbuf: array[0..255] of char;
+  lockDir: LongInt;
 begin
   checkCTRLC;
-  Dir:='';
+  Dir := '';
 
-  if not GetCurrentDirName(tmpbuf,256) then
-    dosError2InOut(IoErr)
-  else
-    begin
-      Dir:=tmpbuf;
-      SetCodePage(Dir,DefaultFileSystemCodePage,false);
-    end;
+  { dos.library's GetCurrentDirName() doesn't work when called from
+    Workbench (ie. when the process has no CLI sructure) }
+  { it also doesn't seem to work when invoked from make on AROS }
+  LockDir := CurrentDir(0);
+  NameFromLock(LockDir, tmpBuf, 256);
+  CurrentDir(LockDir);
+  Dir := tmpBuf;
+  SetCodePage(Dir,DefaultSystemCodePage,false);
 end;