]> 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 2bb2a424022dc06af37069008865ba8963078f43..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