X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffbcbbb45a557cd03448bb6336199447e2902532..ff7b1510ea7f7855091df83d75a44415dc1cba18:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 0bf48eeb78..5688b9aa41 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -85,6 +85,9 @@ wxString wxFileConfig::GetGlobalDir() #ifdef __UNIX__ strDir = "/etc/"; + #elif defined(__WXSTUBS__) + // TODO + wxASSERT( TRUE ) ; #else // Windows #ifndef _MAX_PATH #define _MAX_PATH 512 @@ -220,18 +223,18 @@ wxFileConfig::wxFileConfig(const wxString& strLocal, const wxString& strGlobal) : m_strLocalFile(strLocal), m_strGlobalFile(strGlobal) { // if the path is not absolute, prepend the standard directory to it - - if ( !strLocal.IsEmpty() && !wxIsPathSeparator(strLocal[0u]) ) + if ( !strLocal.IsEmpty() && !wxIsAbsolutePath(strLocal) ) { m_strLocalFile = GetLocalDir(); m_strLocalFile << strLocal; } - if ( !strGlobal.IsEmpty() && !wxIsPathSeparator(strGlobal[0u]) ) + if ( !strGlobal.IsEmpty() && !wxIsAbsolutePath(strGlobal) ) { m_strGlobalFile = GetGlobalDir(); m_strGlobalFile << strGlobal; } + Init(); } @@ -532,6 +535,8 @@ bool wxFileConfig::Read(wxString *pstr, ConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); if (pEntry == NULL) { + if( IsRecordingDefaults() ) + ((wxFileConfig *)this)->Write(szKey,szDefault); *pstr = ExpandEnvVars(szDefault); return FALSE; } @@ -570,7 +575,7 @@ bool wxFileConfig::Write(const char *szKey, const char *szValue) wxString strName = path.Name(); if ( strName.IsEmpty() ) { // setting the value of a group is an error - wxASSERT_MSG( IsEmpty(szValue), "can't set value of a group!" ); + wxASSERT_MSG( IsEmpty(szValue), _("can't set value of a group!") ); // ... except if it's empty in which case it's a way to force it's creation m_pCurrentGroup->SetDirty(); @@ -1309,6 +1314,9 @@ wxString FilterIn(const wxString& str) // quote the string before writing it to file wxString FilterOut(const wxString& str) { + if(str.IsEmpty()) + return str; + wxString strResult; strResult.Alloc(str.Len());