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