- SFSaveDisk = 0x214, CurDirStore = 0x398
- };
- FSSpec cwdSpec ;
-
- FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
- wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
- strcpy( buf , res ) ;
- if (0) {
-#else
- if (getcwd(cbuf, sz) == NULL) {
-#endif
- delete [] cbuf;
-#else // wxUnicode
-#ifdef _MSC_VER
- if (_getcwd(buf, sz) == NULL) {
-#elif defined(__WXMAC__) && !defined(__DARWIN__)
- 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 )
+ buf = new wxChar[sz + 1];
+ }
+
+ bool ok = FALSE;
+
+ // for the compilers which have Unicode version of _getcwd(), call it
+ // directly, for the others call the ANSI version and do the translation
+#if !wxUSE_UNICODE
+ #define cbuf buf
+#else // wxUSE_UNICODE
+ bool needsANSI = TRUE;
+
+ #if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU
+ wxCharBuffer c_buffer(sz);
+ char *cbuf = (char*)(const char*)c_buffer;
+ #endif
+
+ #ifdef HAVE_WGETCWD
+ #if wxUSE_UNICODE_MSLU
+ if ( wxGetOsVersion() != wxWIN95 )
+ #else
+ char *cbuf = NULL; // never really used because needsANSI will always be FALSE
+ #endif
+ {
+ ok = _wgetcwd(buf, sz) != NULL;
+ needsANSI = FALSE;
+ }
+ #endif
+
+ if ( needsANSI )
+#endif // wxUSE_UNICODE