X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/863210791ab214e9c5739b834d9a5737d3d52800..0a33446c8e71292bfdb960ed7e26e1f196938cf0:/src/common/fileconf.cpp?ds=sidebyside diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 8f1775f0dd..a6107188c9 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -297,8 +297,8 @@ wxString wxFileConfig::GetLocalDir() { wxString strDir; -#if defined(__WXMAC__) - // no local dir concept on Mac OS 9 +#if defined(__WXMAC__) || defined(__DOS__) + // no local dir concept on Mac OS 9 or MS-DOS return GetGlobalDir() ; #else wxGetHomeDir(&strDir); @@ -349,7 +349,7 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile) str << szFile; - #ifdef __WXMSW__ + #if defined(__WINDOWS__) || defined(__DOS__) if ( wxStrchr(szFile, wxT('.')) == NULL ) str << wxT(".ini"); #endif @@ -819,8 +819,7 @@ bool wxFileConfig::HasEntry(const wxString& strName) const // read/write values // ---------------------------------------------------------------------------- -bool wxFileConfig::Read(const wxString& key, - wxString* pStr) const +bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const { wxConfigPathChanger path(this, key); @@ -829,32 +828,12 @@ bool wxFileConfig::Read(const wxString& key, return FALSE; } - *pStr = ExpandEnvVars(pEntry->Value()); - return TRUE; -} - -bool wxFileConfig::Read(const wxString& key, - wxString* pStr, const wxString& defVal) const -{ - wxConfigPathChanger path(this, key); - - wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); - bool ok; - if (pEntry == NULL) { - if( IsRecordingDefaults() ) - ((wxFileConfig *)this)->Write(key,defVal); - *pStr = ExpandEnvVars(defVal); - ok = FALSE; - } - else { - *pStr = ExpandEnvVars(pEntry->Value()); - ok = TRUE; - } + *pStr = pEntry->Value(); - return ok; + return TRUE; } -bool wxFileConfig::Read(const wxString& key, long *pl) const +bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const { wxString str; if ( !Read(key, & str) ) @@ -862,11 +841,10 @@ bool wxFileConfig::Read(const wxString& key, long *pl) const return FALSE; } - *pl = wxAtol(str); - return TRUE; + return str.ToLong(pl); } -bool wxFileConfig::Write(const wxString& key, const wxString& szValue) +bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue) { wxConfigPathChanger path(this, key); @@ -901,12 +879,9 @@ bool wxFileConfig::Write(const wxString& key, const wxString& szValue) return TRUE; } -bool wxFileConfig::Write(const wxString& key, long lValue) +bool wxFileConfig::DoWriteLong(const wxString& key, long lValue) { - // ltoa() is not ANSI :-( - wxString buf; - buf.Printf(wxT("%ld"), lValue); - return Write(key, buf); + return Write(key, wxString::Format(_T("%ld"), lValue)); } bool wxFileConfig::Flush(bool /* bCurrentOnly */)