corrected cwd manipulation for unicode builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -635,18 +635,12 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
wxString startupCwd = wxGetCwd() ;
|
wxString startupCwd = wxGetCwd() ;
|
||||||
if ( startupCwd == wxT("/") || startupCwd.Right(15) == wxT("/Contents/MacOS") )
|
if ( startupCwd == wxT("/") || startupCwd.Right(15) == wxT("/Contents/MacOS") )
|
||||||
{
|
{
|
||||||
wxString cwd ;
|
|
||||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ;
|
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ;
|
||||||
CFURLRef urlParent = CFURLCreateCopyDeletingLastPathComponent( kCFAllocatorDefault , url ) ;
|
CFURLRef urlParent = CFURLCreateCopyDeletingLastPathComponent( kCFAllocatorDefault , url ) ;
|
||||||
CFRelease( url ) ;
|
CFRelease( url ) ;
|
||||||
CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ;
|
CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ;
|
||||||
CFRelease( urlParent ) ;
|
CFRelease( urlParent ) ;
|
||||||
CFIndex len = CFStringGetLength( path ) ;
|
wxString cwd = wxMacCFStringHolder(path).AsString(wxLocale::GetSystemEncoding());
|
||||||
CFIndex max = CFStringGetMaximumSizeForEncoding( len, kCFStringEncodingUTF8 ) ;
|
|
||||||
wxChar* buf = cwd.GetWriteBuf( max ) ;
|
|
||||||
CFStringGetCString( path , buf , max + 1 , kCFStringEncodingUTF8 ) ;
|
|
||||||
CFRelease( path ) ;
|
|
||||||
cwd.UngetWriteBuf() ;
|
|
||||||
wxSetWorkingDirectory( cwd ) ;
|
wxSetWorkingDirectory( cwd ) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user