X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/937afade13326376cf1d3071057d069041172daa..095472c0da262f8a686a6adfef0362c3eada3ccb:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 721448750d..def73f29d7 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -57,6 +57,7 @@ #else #include #include + #include #endif #ifdef __UNIX__ @@ -113,11 +114,11 @@ extern wxChar *wxBuffer; -#ifdef __WXMAC__ -#include "morefile.h" -#include "moreextr.h" -#include "fullpath.h" -#include "fspcompa.h" +#if defined(__WXMAC__) && !defined(__UNIX__) + #include "morefile.h" + #include "moreextr.h" + #include "fullpath.h" + #include "fspcompa.h" #endif IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxStringList) @@ -816,7 +817,7 @@ wxString wxPathOnly (const wxString& path) // and back again - or we get nasty problems with delimiters. // Also, convert to lower case, since case is significant in UNIX. -#ifdef __WXMAC__ +#if defined(__WXMAC__) && !defined(__UNIX__) static char sMacFileNameConversion[ 1000 ] ; @@ -1057,7 +1058,7 @@ wxCopyFile (const wxString& file1, const wxString& file2) return FALSE; } -#ifndef __VISAGECPP__ +#if !defined(__VISAGECPP__) && !defined(__WXMAC__) // no chmod in VA. SHould be some permission API for HPFS386 partitions however if ( chmod(file2, fbuf.st_mode) != 0 ) { @@ -1682,16 +1683,40 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) #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