From 898efd1a880a264538d13266ea33e3205a4e032e Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 20 Jan 1999 12:23:40 +0000 Subject: [PATCH] Fixed wxConfig (I hope) and disabled wxRegConfig::DeleteAll. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/msw.rsp | 1 + samples/config/conftest.cpp | 6 +++--- src/common/config.cpp | 6 ++++-- src/msw/regconf.cpp | 6 +++++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp index 7934c19e9c..05f261da53 100644 --- a/distrib/msw/msw.rsp +++ b/distrib/msw/msw.rsp @@ -18,6 +18,7 @@ src/makesc.env src/makeg95.env src/makesl.env src/makeprog.sl +src/salford.lnk src/ntwxwin.mak src/maketwin.env src/makeprog.twn diff --git a/samples/config/conftest.cpp b/samples/config/conftest.cpp index 4626dd0122..4d485ac269 100644 --- a/samples/config/conftest.cpp +++ b/samples/config/conftest.cpp @@ -204,15 +204,15 @@ void MyFrame::OnDelete(wxCommandEvent&) { // VZ: it seems that DeleteAll() wreaks havoc on NT. Disabled until I // investigate it further, do _not_ compile this code in meanwhile! -#if 0 - if ( wxConfigBase::Get()->DeleteAll() ) { + // JACS: wxRegConfig::DeleteAll is disabled, so it's safe to call DeleteAll, + // it just won't do anything useful on Win95/NT. + if ( wxConfigBase::Get()->DeleteAll() ) { wxLogMessage("Config file/registry key successfully deleted."); delete wxConfigBase::Set((wxConfigBase *) NULL); wxConfigBase::DontCreateOnDemand(); } else -#endif // 0 wxLogError("Deleting config file/registry key failed."); } diff --git a/src/common/config.cpp b/src/common/config.cpp index 47cf94f498..d858319795 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -226,7 +226,8 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) { m_pContainer = (wxConfigBase *)pContainer; - wxString strPath = strEntry.Before(wxCONFIG_PATH_SEPARATOR); +// wxString strPath = strEntry.Before(wxCONFIG_PATH_SEPARATOR); + wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR); // special case of "/keyname" when there is nothing before "/" if ( strPath.IsEmpty() && ((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR )) @@ -235,7 +236,8 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, if ( !strPath.IsEmpty() ) { // do change the path m_bChanged = TRUE; - m_strName = strEntry.Right(wxCONFIG_PATH_SEPARATOR); +// m_strName = strEntry.Right(wxCONFIG_PATH_SEPARATOR); + m_strName = strEntry.AfterLast(wxCONFIG_PATH_SEPARATOR); m_strOldPath = m_pContainer->GetPath(); m_strOldPath += wxCONFIG_PATH_SEPARATOR; m_pContainer->SetPath(strPath); diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 2fe6d9da58..f06413bf31 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -467,12 +467,16 @@ bool wxRegConfig::DeleteAll() { m_keyLocal.Close(); m_keyGlobal.Close(); - +#if 1 + wxFAIL_MSG("wxRegConfig::DeleteAll will wipe out your entire registry, so please do not use until it's fixed!"); + return FALSE; +#else bool bOk = m_keyLocalRoot.DeleteSelf(); if ( bOk ) bOk = m_keyGlobalRoot.DeleteSelf(); return bOk; +#endif } #endif -- 2.47.2