- FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
- wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
- strcpy( buf , res ) ;
- */
- if (0) {
-#elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
- APIRET rc;
- rc = ::DosQueryCurrentDir( 0 // current drive
- ,buf
- ,(PULONG)&sz
- );
- if (rc != 0) {
-#else
- if (getcwd(buf, sz) == NULL) {
-#endif
-#endif
- buf[0] = wxT('.');
- buf[1] = wxT('\0');
- }
-#if wxUSE_UNICODE
- else {
- wxConvFile.MB2WC(buf, cbuf, sz);
- delete [] cbuf;
- }
+ // VZ: the old code used to return "." on error which didn't make any
+ // sense at all to me - empty string is a better error indicator
+ // (NULL might be even better but I'm afraid this could lead to
+ // problems with the old code assuming the return is never NULL)
+ buf[0] = _T('\0');
+ }
+ else // ok, but we might need to massage the path into the right format
+ {
+#ifdef __DJGPP__
+ // VS: DJGPP is a strange mix of DOS and UNIX API and returns paths
+ // with / deliminers. We don't like that.
+ for (wxChar *ch = buf; *ch; ch++)
+ {
+ if (*ch == wxT('/'))
+ *ch = wxT('\\');
+ }
+#endif // __DJGPP__
+
+#ifdef __CYGWIN__
+ // another example of DOS/Unix mix (Cygwin)
+ wxString pathUnix = buf;
+ cygwin_conv_to_full_win32_path(pathUnix, buf);
+#endif // __CYGWIN__
+ }
+
+ return buf;
+
+#if !wxUSE_UNICODE
+ #undef cbuf