]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filefn.cpp
message output for darwin into console, cannot use the normal converters as these...
[wxWidgets.git] / src / common / filefn.cpp
index fbf8733e9f8c8537227521dc6ff8d142e9f35ff0..e2270201730cb94c12673c4532c951838940b428 100644 (file)
@@ -51,7 +51,7 @@
 #endif
 
 #if defined(__WXMAC__)
-  #include  "wx/mac/private.h"  // includes mac headers
+    #include  "wx/mac/private.h"  // includes mac headers
 #endif
 
 #ifdef __WXWINCE__
@@ -923,9 +923,28 @@ wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
     Str255    theParentPath = "\p";
     FSSpec      theParentSpec;
     FSRef       theParentRef;
+    FSRef       theRef ;
     char        theFileName[FILENAME_MAX];
     char        thePath[FILENAME_MAX];
 
+    // we loose the long filename by merely copying the spec->name
+    // so try the built-ins, which only work if the file exists, but still...
+    
+    theErr = FSpMakeFSRef(spec, &theRef);
+    if ( theErr == noErr )
+    {
+       CFURLRef fullURLRef;
+        fullURLRef = ::CFURLCreateFromFSRef(NULL, &theRef);
+#ifdef __UNIX__
+       CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
+#else
+       CFURLPathStyle pathstyle = kCFURLHFSPathStyle;
+#endif
+       CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle);
+       ::CFRelease( fullURLRef ) ;
+       return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
+    }
+
     strcpy(thePath, "");
 
     // GD: Separate file name from path and make a FSRef to the parent
@@ -1309,7 +1328,8 @@ bool wxRemoveFile(const wxString& file)
  || defined(__BORLANDC__) \
  || defined(__WATCOMC__) \
  || defined(__DMC__) \
- || defined(__GNUWIN32__)
+ || defined(__GNUWIN32__) \
+ || (defined(__MWERKS__) && defined(__MSL__))
   int res = wxRemove(file);
 #elif defined(__WXMAC__)
   int res = unlink(wxFNCONV(file));