Ensure that paths used inside wxOSX are always in NFC form.

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
This commit is contained in:
Vadim Zeitlin 2012-11-04 23:54:15 +00:00
parent 4ccde09b18
commit 318955603b
4 changed files with 5 additions and 5 deletions

View 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);

View 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 )

View 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);

View 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