Przeglądaj źródła

+ Added optional path translation mechanism

olle 20 lat temu
rodzic
commit
d4b4756c01
4 zmienionych plików z 25 dodań i 7 usunięć
  1. 8 3
      rtl/macos/dos.pp
  2. 3 0
      rtl/macos/macutils.inc
  3. 4 2
      rtl/macos/sysfile.inc
  4. 10 2
      rtl/macos/system.pp

+ 8 - 3
rtl/macos/dos.pp

@@ -56,7 +56,7 @@ Implementation
 
 {TODO Perhaps add some kind of "Procedure AddDisk" for accessing other
  volumes. At lest accessing the possible disk drives with
- driver number 1 and 2 should be easy.}
+ drive number 1 and 2 should be easy.}
 
 {TODO Perhaps use LongDateTime for time functions. But the function
  calls must then be weak linked.}
@@ -736,7 +736,8 @@ End;
     if (Pos('?', Path) <> 0) or (Pos('*', Path) <> 0) then
       Exit;
 
-    path := TranslatePathToMac(path, false);
+    if pathTranslation then
+      path := TranslatePathToMac(path, false);
 
     {Search in working directory, or as full path}
     fpcerr := PathArgToFSSpec(path, spec);
@@ -757,7 +758,11 @@ End;
           p1 := Pos(PathSeparator, DirList);
           if p1 = 0 then
             p1 := 255;
-          NewDir := TranslatePathToMac(Copy(DirList, 1, P1 - 1), false);
+
+          if pathTranslation then
+            NewDir := TranslatePathToMac(Copy(DirList, 1, P1 - 1), false)
+					else
+            NewDir := Copy(DirList, 1, P1 - 1);					
 
           NewDir := ConcatMacPath(NewDir, Path);
 

+ 3 - 0
rtl/macos/macutils.inc

@@ -396,6 +396,9 @@ function PathArgToFSSpec(s: string; var spec: FSSpec): Integer;
 var
   err: OSErr;
 begin
+  if pathTranslation then
+    s := TranslatePathToMac(s, false);
+
   err:= FSMakeFSSpec(workingDirectorySpec.vRefNum,
       workingDirectorySpec.parID, s, spec);
   PathArgToFSSpec := MacOSErr2RTEerr(err);

+ 4 - 2
rtl/macos/sysfile.inc

@@ -220,7 +220,6 @@ var
   finderInfo: FInfo;
 
 begin
-  // AllowSlash(p);
 
 { close first if opened }
   if ((flags and $10000)=0) then
@@ -353,7 +352,10 @@ end;
 
 {
    $Log$
-   Revision 1.2  2005-02-14 17:13:30  peter
+   Revision 1.3  2005-03-20 19:37:31  olle
+     + Added optional path translation mechanism
+
+   Revision 1.2  2005/02/14 17:13:30  peter
      * truncate log
 
    Revision 1.1  2005/02/07 21:30:12  peter

+ 10 - 2
rtl/macos/system.pp

@@ -63,6 +63,11 @@ procedure Yield;
 procedure SetDefaultMacOSFiletype(ftype: ShortString);
 procedure SetDefaultMacOSCreator(creator: ShortString);
 
+var
+  {Whether unix and dos style paths should be translated. Default false}
+  pathTranslation: Boolean;
+
+
 {*********************************}
 {**  Available features on macos **}
 {*********************************}
@@ -464,7 +469,6 @@ begin
 {$WARNING To be implemented - using GetProcessInformation???}
 end;
 
-
 var
   resHdl: Mac_Handle;
   isFolder, hadAlias, leafIsAlias: Boolean;
@@ -500,6 +504,7 @@ begin
 
   StackLength := InitialStkLen;
   StackBottom := SPtr - StackLength;
+  pathTranslation:= false;
 
   { Setup working directory }
   if StandAlone <> 0 then
@@ -554,7 +559,10 @@ end.
 
 {
   $Log$
-  Revision 1.30  2005-02-14 17:13:30  peter
+  Revision 1.31  2005-03-20 19:37:31  olle
+    + Added optional path translation mechanism
+
+  Revision 1.30  2005/02/14 17:13:30  peter
     * truncate log
 
   Revision 1.29  2005/02/07 21:30:12  peter