X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b925352b3a2e0fb2cb1a245b7c7a0de1b0b97a89..d1427b705318677afe28b1291867f6930c8823a7:/src/common/fileconf.cpp?ds=inline diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 46139022fd..24d10b9833 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -124,7 +124,7 @@ wxString wxFileConfig::GetLocalDir() strDir << szHome; #else // Win16 // Win16 has no idea about home, so use the current directory instead - strDir = ".\\"; + strDir = ".\\"; #endif // WIN16/32 #endif // UNIX/Win @@ -220,18 +220,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 +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; } @@ -570,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(); @@ -671,17 +673,13 @@ bool wxFileConfig::DeleteAll() { CleanUp(); - m_strLocalFile = m_strGlobalFile = ""; - Init(); - const char *szFile = m_strLocalFile; 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(); return TRUE; } @@ -1342,8 +1340,10 @@ wxString FilterOut(const wxString& str) break; case '"': - if ( bQuote ) + if ( bQuote ) { c = '"'; + break; + } //else: fall through default: