]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filefn.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / common / filefn.cpp
index 997ebf2ba4edde20e178bac187eb81baa0be95e7..2e04e80098cb9d0233f83ef37ca598cf4315d576 100644 (file)
@@ -842,6 +842,9 @@ wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathCompon
 {
     CFURLRef fullURLRef;
     fullURLRef = CFURLCreateFromFSRef(NULL, fsRef);
+    if ( fullURLRef == NULL)
+        return wxEmptyString;
+    
     if ( additionalPathComponent )
     {
         CFURLRef parentURLRef = fullURLRef ;
@@ -849,12 +852,10 @@ wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathCompon
             additionalPathComponent,false);
         CFRelease( parentURLRef ) ;
     }
-    CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
+    wxCFStringRef cfString( CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle ));
     CFRelease( fullURLRef ) ;
-    CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString);
-    CFRelease( cfString );
-    CFStringNormalize(cfMutableString,kCFStringNormalizationFormC);
-    return wxCFStringRef(cfMutableString).AsString();
+
+    return wxCFStringRef::AsStringWithNormalizationFormC(cfString);
 }
 
 OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
@@ -879,13 +880,10 @@ OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
 
 wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
 {
-    CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault,
+    wxCFStringRef cfname( CFStringCreateWithCharacters( kCFAllocatorDefault,
                                                       uniname->unicode,
-                                                      uniname->length );
-    CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfname);
-    CFRelease( cfname );
-    CFStringNormalize(cfMutableString,kCFStringNormalizationFormC);
-    return wxCFStringRef(cfMutableString).AsString() ;
+                                                      uniname->length ) );
+    return wxCFStringRef::AsStringWithNormalizationFormC(cfname);
 }
 
 #ifndef __LP64__
@@ -1576,8 +1574,12 @@ wxString wxGetOSDirectory()
 #ifdef __WXWINCE__
     return wxString(wxT("\\Windows"));
 #elif defined(__WINDOWS__) && !defined(__WXMICROWIN__)
-    wxChar buf[256];
-    GetWindowsDirectory(buf, 256);
+    wxChar buf[MAX_PATH];
+    if ( !GetWindowsDirectory(buf, MAX_PATH) )
+    {
+        wxLogLastError(wxS("GetWindowsDirectory"));
+    }
+
     return wxString(buf);
 #elif defined(__WXMAC__) && wxOSX_USE_CARBON
     return wxMacFindFolderNoSeparator(kOnSystemDisk, 'macs', false);