]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filefn.cpp
wxADJUST_MIN definition (forgot to ci last time)
[wxWidgets.git] / src / common / filefn.cpp
index ea1417f900913a05e0f3e257083fa7045b7858fa..6d2afb1a79614a39efede738b76ec2f59813e28d 100644 (file)
@@ -57,6 +57,7 @@
 #else
     #include <stat.h>
     #include <unistd.h>
 #else
     #include <stat.h>
     #include <unistd.h>
+    #include <unix.h>
 #endif
 
 #ifdef __UNIX__
 #endif
 
 #ifdef __UNIX__
@@ -1057,13 +1058,15 @@ wxCopyFile (const wxString& file1, const wxString& file2)
             return FALSE;
     }
 
             return FALSE;
     }
 
+#ifndef __VISAGECPP__
+// no chmod in VA.  SHould be some permission API for HPFS386 partitions however
     if ( chmod(file2, fbuf.st_mode) != 0 )
     {
         wxLogSysError(_("Impossible to set permissions for the file '%s'"),
                       file2.c_str());
         return FALSE;
     }
     if ( chmod(file2, fbuf.st_mode) != 0 )
     {
         wxLogSysError(_("Impossible to set permissions for the file '%s'"),
                       file2.c_str());
         return FALSE;
     }
-
+#endif
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -1680,16 +1683,40 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
 #ifdef _MSC_VER
   if (_getcwd(buf, sz) == NULL) {
 #elif defined( __WXMAC__)
 #ifdef _MSC_VER
   if (_getcwd(buf, sz) == NULL) {
 #elif defined( __WXMAC__)
-    enum
-    {
-        SFSaveDisk = 0x214, CurDirStore = 0x398
-    };
-    FSSpec cwdSpec ;
-
-    FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
-    wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
-    strcpy( buf , res ) ;
-    if (0) {
+       FSSpec cwdSpec ;
+       FCBPBRec pb;
+       OSErr error;
+       Str255  fileName ;
+       pb.ioNamePtr = (StringPtr) &fileName;
+       pb.ioVRefNum = 0;
+       pb.ioRefNum = LMGetCurApRefNum();
+       pb.ioFCBIndx = 0;
+       error = PBGetFCBInfoSync(&pb);
+       if ( error == noErr ) 
+       {
+               cwdSpec.vRefNum = pb.ioFCBVRefNum;
+               cwdSpec.parID = pb.ioFCBParID;
+               cwdSpec.name[0] = 0 ;
+               wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
+               
+               strcpy( buf , res ) ;
+               buf[res.length()-1]=0 ;
+       }
+       else
+               buf[0] = 0 ;
+       /*
+       this version will not always give back the application directory on mac
+       enum 
+       { 
+               SFSaveDisk = 0x214, CurDirStore = 0x398 
+       };
+       FSSpec cwdSpec ;
+       
+       FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
+       wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
+       strcpy( buf , res ) ;
+       */
+       if (0) {
 #elif(__VISAGECPP__)
     APIRET rc;
     rc = ::DosQueryCurrentDir( 0 // current drive
 #elif(__VISAGECPP__)
     APIRET rc;
     rc = ::DosQueryCurrentDir( 0 // current drive