]> git.saurik.com Git - wxWidgets.git/commitdiff
Ensure that paths used inside wxOSX are always in NFC form.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Nov 2012 23:54:15 +0000 (23:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Nov 2012 23:54:15 +0000 (23:54 +0000)
OSX uses NFKD but this is unexpected for wx applications, so normalize the
string to use the composed form whenever we receive a file system path from OS
X.

Closes #13504.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/dirdlg.mm
src/osx/cocoa/filedlg.mm
src/osx/cocoa/utils.mm
src/osx/core/stdpaths_cf.cpp

index 700969c3ee598d851fd7cd469ec4b5fba9ed52bc..ad757e2adcc60f35b617821bac84d9c71908e671 100644 (file)
@@ -120,7 +120,7 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode)
     if (returnCode == NSOKButton )
     {
         NSOpenPanel* oPanel = (NSOpenPanel*)panel;
-        SetPath( wxCFStringRef::AsString([[oPanel filenames] objectAtIndex:0]));
+        SetPath( wxCFStringRef::AsStringWithNormalizationFormC([[oPanel filenames] objectAtIndex:0]));
         result = wxID_OK;
     }
     SetReturnCode(result);
index 6e4e5c4f2c243a8e7af63960de8e8abbb31bd501..40fd8c42947396b9295e28bc64ad6a9e04cc5653 100644 (file)
@@ -651,7 +651,7 @@ void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode)
             NSSavePanel* sPanel = (NSSavePanel*)panel;
             result = wxID_OK;
 
-            m_path = wxCFStringRef::AsString([sPanel filename]);
+            m_path = wxCFStringRef::AsStringWithNormalizationFormC([sPanel filename]);
             m_fileName = wxFileNameFromPath(m_path);
             m_dir = wxPathOnly( m_path );
             if (m_filterChoice)
@@ -670,7 +670,7 @@ void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode)
             NSArray* filenames = [oPanel filenames];
             for ( size_t i = 0 ; i < [filenames count] ; ++ i )
             {
-                wxString fnstr = wxCFStringRef::AsString([filenames objectAtIndex:i]);
+                wxString fnstr = wxCFStringRef::AsStringWithNormalizationFormC([filenames objectAtIndex:i]);
                 m_paths.Add( fnstr );
                 m_fileNames.Add( wxFileNameFromPath(fnstr) );
                 if ( i == 0 )
index ef5aefa5389935a5b34e5903464fa54e25ad5c6d..8b80a601b125bef1514d9d309fbb1a98023b3b8f 100644 (file)
@@ -71,7 +71,7 @@ void wxBell()
     const size_t count = [fileNames count];
     for (i = 0; i < count; i++)
     {
-        fileList.Add( wxCFStringRef::AsString([fileNames objectAtIndex:i]) );
+        fileList.Add( wxCFStringRef::AsStringWithNormalizationFormC([fileNames objectAtIndex:i]) );
     }
 
     wxTheApp->MacOpenFiles(fileList);
index de312789c9b72b3aadf7cd48ff96aa793c2219a4..f5bf602b112231ca48769105162c1285f65fefb3 100644 (file)
@@ -83,7 +83,7 @@ static wxString BundleRelativeURLToPath(CFURLRef relativeURL)
     wxCHECK_MSG(absoluteURL, wxEmptyString, wxT("Failed to resolve relative URL to absolute URL"));
     CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kDefaultPathStyle);
     CFRelease(absoluteURL);
-    return wxCFStringRef(cfStrPath).AsString(wxLocale::GetSystemEncoding());
+    return wxCFStringRef::AsStringWithNormalizationFormC(cfStrPath);
 }
 
 wxString wxStandardPathsCF::GetFromFunc(wxCFURLRef (*func)(wxCFBundleRef)) const