]> git.saurik.com Git - wxWidgets.git/commitdiff
discard the debug directories at the end of the executable path automatically in...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Mar 2006 18:31:44 +0000 (18:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Mar 2006 18:31:44 +0000 (18:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/stdpaths.h
src/msw/stdpaths.cpp

index c12729857e9dfd6a07defe498e2df9dbe2d81189..5273872dcedb40b643646e1754c76ad76fbab773 100644 (file)
@@ -26,12 +26,13 @@ public:
     virtual wxString GetUserDataDir() const;
     virtual wxString GetUserLocalDataDir() const;
     virtual wxString GetPluginsDir() const;
-    virtual wxString GetLocalizedResourcesDir(const wxChar *lang,
-                                              ResourceCat category) const;
 
 protected:
     // get the path corresponding to the given standard CSIDL_XXX constant
     static wxString DoGetDirectory(int csidl);
+
+    // return the directory of the application itself
+    static wxString GetAppDir();
 };
 
 // ----------------------------------------------------------------------------
index 2a7a046dd6300c51197f05157063474bf07d51d0..5e9de59ee3b2ca0bb81cb22044589ca958e6e875 100644 (file)
@@ -242,6 +242,26 @@ wxString wxStandardPaths::DoGetDirectory(int csidl)
     return dir;
 }
 
+/* static */
+wxString wxStandardPaths::GetAppDir()
+{
+    wxFileName fn(wxGetFullModuleName());
+
+    // allow running the apps directly from build directory in debug builds
+#ifdef __WXDEBUG__
+    wxString lastdir;
+    if ( fn.GetDirCount() )
+    {
+        lastdir = fn.GetDirs().Last();
+        lastdir.MakeLower();
+        if ( lastdir.Matches(_T("debug*")) || lastdir.Matches(_T("vc_msw*")) )
+            fn.RemoveLastDir();
+    }
+#endif // __WXDEBUG__
+
+    return fn.GetPath();
+}
+
 // ----------------------------------------------------------------------------
 // public functions
 // ----------------------------------------------------------------------------
@@ -260,7 +280,7 @@ wxString wxStandardPaths::GetDataDir() const
 {
     // under Windows each program is usually installed in its own directory and
     // so its datafiles are in the same directory as its main executable
-    return wxFileName(wxGetFullModuleName()).GetPath();
+    return GetAppDir();
 }
 
 wxString wxStandardPaths::GetUserDataDir() const
@@ -275,7 +295,9 @@ wxString wxStandardPaths::GetUserLocalDataDir() const
 
 wxString wxStandardPaths::GetPluginsDir() const
 {
-    return wxFileName(wxGetFullModuleName()).GetPath();
+    // there is no standard location for plugins, suppose they're in the same
+    // directory as the .exe
+    return GetAppDir();
 }
 
 // ============================================================================