X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/898efd1a880a264538d13266ea33e3205a4e032e..6c41a418df66b66711eba536526a3085f690782e:/src/common/config.cpp diff --git a/src/common/config.cpp b/src/common/config.cpp index d858319795..4a0935b93c 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -14,43 +14,32 @@ // headers // ---------------------------------------------------------------------------- #ifdef __GNUG__ - #pragma implementation "confbase.h" + #pragma implementation "confbase.h" #endif -#include "wx/wxprec.h" +#include "wx/wxprec.h" #ifndef WX_PRECOMP -#include "wx/wx.h" + #include "wx/wx.h" #endif -#include - -#ifdef wxUSE_CONFIG +#if wxUSE_CONFIG #ifdef __BORLANDC__ #pragma hdrstop #endif //__BORLANDC__ -#include -#include -#include -#include -#include - -// we must include (one of) these files for wxConfigBase::Create -#if defined(__WXMSW__) && defined(wxCONFIG_WIN32_NATIVE) - #ifdef __WIN32__ - #include - #else //WIN16 - #include - #endif -#else // either we're under Unix or wish to use files even under Windows - #include -#endif +#include "wx/app.h" +#include "wx/file.h" +#include "wx/log.h" +#include "wx/textfile.h" +#include "wx/utils.h" -#include -#include -#include // for isalnum() +#include "wx/config.h" + +#include +#include +#include // for isalnum() // ---------------------------------------------------------------------------- // global and class static variables @@ -226,17 +215,20 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) { m_pContainer = (wxConfigBase *)pContainer; -// wxString strPath = strEntry.Before(wxCONFIG_PATH_SEPARATOR); + + // the path is everything which precedes the last slash wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR); - // special case of "/keyname" when there is nothing before "/" - if ( strPath.IsEmpty() && ((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR )) + // except in the special case of "/keyname" when there is nothing before "/" + if ( strPath.IsEmpty() && + ((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) ) + { strPath = wxCONFIG_PATH_SEPARATOR; + } if ( !strPath.IsEmpty() ) { // do change the path m_bChanged = TRUE; -// m_strName = strEntry.Right(wxCONFIG_PATH_SEPARATOR); m_strName = strEntry.AfterLast(wxCONFIG_PATH_SEPARATOR); m_strOldPath = m_pContainer->GetPath(); m_strOldPath += wxCONFIG_PATH_SEPARATOR; @@ -410,7 +402,5 @@ void wxSplitPath(wxArrayString& aParts, const char *sz) } } -#endif - - // wxUSE_CONFIG +#endif // wxUSE_CONFIG