X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/275bf4c13ab7f4b041b0d5c78cfdece709800d14..f6d5397840a7cfe694c6c82b8f560e7b27978d25:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 46ea7077a3..24d10b9833 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -220,14 +220,17 @@ 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]) ) - m_strLocalFile = GetLocalDir(); - m_strLocalFile << strLocal; - - if ( !strGlobal.IsEmpty() && !wxIsPathSeparator(strGlobal[0u]) ) - m_strGlobalFile = GetGlobalDir(); - m_strGlobalFile << strGlobal; + if ( !strLocal.IsEmpty() && !wxIsAbsolutePath(strLocal) ) + { + m_strLocalFile = GetLocalDir(); + m_strLocalFile << strLocal; + } + + if ( !strGlobal.IsEmpty() && !wxIsAbsolutePath(strGlobal) ) + { + m_strGlobalFile = GetGlobalDir(); + m_strGlobalFile << strGlobal; + } Init(); } @@ -529,6 +532,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; } @@ -567,7 +572,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(); @@ -673,10 +678,6 @@ bool wxFileConfig::DeleteAll() if ( remove(szFile) == -1 ) wxLogSysError(_("can't delete user configuration file '%s'"), szFile); - szFile = m_strGlobalFile; - if ( remove(szFile) ) - wxLogSysError(_("can't delete system configuration file '%s'"), szFile); - m_strLocalFile = m_strGlobalFile = ""; Init(); @@ -1339,8 +1340,10 @@ wxString FilterOut(const wxString& str) break; case '"': - if ( bQuote ) + if ( bQuote ) { c = '"'; + break; + } //else: fall through default: