virtual wxString GetPluginsDir() const;
protected:
- // append "/appname" suffix if the app name is set
- static wxString AppendAppName(const wxString& dir);
-
// get the path corresponding to the given standard CSIDL_XXX constant
static wxString DoGetDirectory(int csidl);
};
// virtual dtor for the base class
virtual ~wxStandardPathsBase();
+
+protected:
+ // append "/appname" suffix if the app name is set (doesn't append the
+ // slash if dir already ends with a slash or dot)
+ static wxString AppendAppName(const wxString& dir);
};
#if defined(__WXMSW__)
#pragma hdrstop
#endif
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+#endif //WX_PRECOMP
+
+#include "wx/filename.h"
#include "wx/stdpaths.h"
// ----------------------------------------------------------------------------
return GetUserDataDir();
}
+/* static */
+wxString wxStandardPathsBase::AppendAppName(const wxString& dir)
+{
+ wxString subdir(dir);
+
+ // empty string indicates that an error has occured, don't touch it then
+ if ( !subdir.empty() )
+ {
+ const wxString appname = wxTheApp->GetAppName();
+ if ( !appname.empty() )
+ {
+ const wxChar ch = *(subdir.end() - 1);
+ if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') )
+ subdir += wxFileName::GetPathSeparator();
+
+ subdir += appname;
+ }
+ }
+
+ return subdir;
+}
+
return dir;
}
-/* static */
-wxString wxStandardPaths::AppendAppName(const wxString& dir)
-{
- wxString subdir(dir);
-
- // empty string indicates that an error has occured, don't touch it then
- if ( !subdir.empty() )
- {
- const wxString appname = wxTheApp->GetAppName();
- if ( !appname.empty() )
- subdir << _T('\\') << appname;
- }
-
- return subdir;
-}
-
// ----------------------------------------------------------------------------
// public functions
// ----------------------------------------------------------------------------