X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/878973f1fa441af15eed900e74d8cbb9e33b0ee2..b77b87881bae2e6306366d79e7fe160334b3d4a2:/src/mac/filedlg.cpp?ds=inline diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index bbb873f7de..f2cb493f4a 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -469,64 +469,36 @@ int wxFileDialog::ShowModal() if (err != noErr) break; + CFURLRef fullURLRef; if (m_dialogStyle & wxSAVE) { CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef); if (parentURLRef) { - CFURLRef fullURLRef = + fullURLRef = ::CFURLCreateCopyAppendingPathComponent(NULL, parentURLRef, navReply.saveFileName, false); ::CFRelease(parentURLRef); - if (fullURLRef) - { - CFStringRef cfString = ::CFURLCopyPath(fullURLRef); - ::CFRelease(fullURLRef); - - if (cfString) - { - // unescape the URL for - // "file name" instead of "file%20name" - CFStringRef cfStringUnescaped = - ::CFURLCreateStringByReplacingPercentEscapes(NULL, - cfString, - CFSTR("")); - ::CFRelease(cfString); - - if (cfStringUnescaped) - { - Size len = CFStringGetLength( cfStringUnescaped ) ; - wxChar* buf = thePath.GetWriteBuf( len ) ; - //buf[0] = '\0'; -#if wxUSE_UNICODE - CFStringGetCharacters(cfStringUnescaped , CFRangeMake( 0 , len ) , (UniChar*) buf ) ; -#else - CFStringGetCString( cfStringUnescaped , buf , len+1 , CFStringGetSystemEncoding() ) ; -#endif - buf[len] = 0 ; - wxMacConvertNewlines10To13( buf ) ; - thePath.UngetWriteBuf() ; - ::CFRelease(cfStringUnescaped); - } - } - } - } - if (!thePath) - { - ::NavDisposeReply(&navReply); - return wxID_CANCEL; } } else { - const short maxpath = 1024 ; - ::FSRefMakePath( &theFSRef , (UInt8*) thePath.GetWriteBuf(maxpath+1),maxpath) ; - thePath.UngetWriteBuf() ; - if (err != noErr) - break; + fullURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef); + } +#ifdef __UNIX__ + CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle; +#else + CFURLPathStyle pathstyle = kCFURLHFSPathStyle; +#endif + CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle); + thePath = wxMacCFStringHolder(cfString).AsString(); + if (!thePath) + { + ::NavDisposeReply(&navReply); + return wxID_CANCEL; } m_path = thePath; m_paths.Add(m_path);