X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f42061b057d964c20ecaab8cb7728a2559867de..16abe93eb44fe991b8b618bc1049f56d68903297:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 47af6e5cd1..9e29f7961c 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -316,7 +316,6 @@ void wxApp::MacReopenApp() } else { - wxTopLevelWindow* win = NULL ; wxTopLevelWindow* firstIconized = NULL ; while (node) { @@ -631,6 +630,20 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding()); #endif +#if TARGET_API_MAC_OSX + // these might be the startup dirs, set them to the 'usual' dir containing the app bundle + wxString startupCwd = wxGetCwd() ; + if ( startupCwd == wxT("/") || startupCwd.Right(15) == wxT("/Contents/MacOS") ) + { + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ; + CFURLRef urlParent = CFURLCreateCopyDeletingLastPathComponent( kCFAllocatorDefault , url ) ; + CFRelease( url ) ; + CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ; + CFRelease( urlParent ) ; + wxString cwd = wxMacCFStringHolder(path).AsString(wxLocale::GetSystemEncoding()); + wxSetWorkingDirectory( cwd ) ; + } +#endif wxMacCreateNotifierTable() ;