Applied fix for patch #846732 'filedalog long filename support'. File dialog now returns ':' separated paths again with Classic/Carbon builds. The fix is attached to the same patch.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24789 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -469,64 +469,36 @@ int wxFileDialog::ShowModal()
|
|||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
CFURLRef fullURLRef;
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_dialogStyle & wxSAVE)
|
||||||
{
|
{
|
||||||
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
||||||
|
|
||||||
if (parentURLRef)
|
if (parentURLRef)
|
||||||
{
|
{
|
||||||
CFURLRef fullURLRef =
|
fullURLRef =
|
||||||
::CFURLCreateCopyAppendingPathComponent(NULL,
|
::CFURLCreateCopyAppendingPathComponent(NULL,
|
||||||
parentURLRef,
|
parentURLRef,
|
||||||
navReply.saveFileName,
|
navReply.saveFileName,
|
||||||
false);
|
false);
|
||||||
::CFRelease(parentURLRef);
|
::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
|
else
|
||||||
{
|
{
|
||||||
const short maxpath = 1024 ;
|
fullURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
||||||
::FSRefMakePath( &theFSRef , (UInt8*) thePath.GetWriteBuf(maxpath+1),maxpath) ;
|
}
|
||||||
thePath.UngetWriteBuf() ;
|
#ifdef __UNIX__
|
||||||
if (err != noErr)
|
CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
|
||||||
break;
|
#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_path = thePath;
|
||||||
m_paths.Add(m_path);
|
m_paths.Add(m_path);
|
||||||
|
@@ -469,64 +469,36 @@ int wxFileDialog::ShowModal()
|
|||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
CFURLRef fullURLRef;
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_dialogStyle & wxSAVE)
|
||||||
{
|
{
|
||||||
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
||||||
|
|
||||||
if (parentURLRef)
|
if (parentURLRef)
|
||||||
{
|
{
|
||||||
CFURLRef fullURLRef =
|
fullURLRef =
|
||||||
::CFURLCreateCopyAppendingPathComponent(NULL,
|
::CFURLCreateCopyAppendingPathComponent(NULL,
|
||||||
parentURLRef,
|
parentURLRef,
|
||||||
navReply.saveFileName,
|
navReply.saveFileName,
|
||||||
false);
|
false);
|
||||||
::CFRelease(parentURLRef);
|
::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
|
else
|
||||||
{
|
{
|
||||||
const short maxpath = 1024 ;
|
fullURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
||||||
::FSRefMakePath( &theFSRef , (UInt8*) thePath.GetWriteBuf(maxpath+1),maxpath) ;
|
}
|
||||||
thePath.UngetWriteBuf() ;
|
#ifdef __UNIX__
|
||||||
if (err != noErr)
|
CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
|
||||||
break;
|
#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_path = thePath;
|
||||||
m_paths.Add(m_path);
|
m_paths.Add(m_path);
|
||||||
|
Reference in New Issue
Block a user