X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dcbe38820019dd8dab9c8c89ebbb310cca7f5e99..c1066cdf62de692cec3b61f68da35263aa17b1c0:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index a261372eaa..7cc86f423d 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -133,7 +133,7 @@ wxString wxFileConfig::GetLocalDir() wxString wxFileConfig::GetGlobalFileName(const char *szFile) { - wxString str = GetLocalDir(); + wxString str = GetGlobalDir(); str << szFile; if ( strchr(szFile, '.') == NULL ) @@ -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; } @@ -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: