]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/app.cpp
fixed MSVC6 compiler warning
[wxWidgets.git] / src / mac / carbon / app.cpp
index e28fe3d9139aa7bba7045f95aa0e7b332baa1e2b..9e29f7961c8359ff1204b354f7afb30000c48879 100644 (file)
@@ -630,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() ;