X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f3943e0276719ed5fc94bb93765df69f91ba10c..7ac05a91abea459438b8ea62074108d3daf39568:/src/msw/regconf.cpp diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 01f2468803..5d8d70f97a 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -221,7 +221,11 @@ void wxRegConfig::SetPath(const wxString& strPath) { strFullPath.reserve(2*m_strPath.length()); - strFullPath << m_strPath << wxCONFIG_PATH_SEPARATOR << strPath; + strFullPath << m_strPath; + if ( strFullPath.Len() == 0 || + strFullPath.Last() != wxCONFIG_PATH_SEPARATOR ) + strFullPath << wxCONFIG_PATH_SEPARATOR; + strFullPath << strPath; } // simplify it: we need to handle ".." here @@ -464,7 +468,7 @@ bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const return bOk; } -size_t wxRegConfig::GetNumberOfEntries(bool bRecursive) const +size_t wxRegConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const { size_t nEntries = 0; @@ -481,7 +485,7 @@ size_t wxRegConfig::GetNumberOfEntries(bool bRecursive) const return nEntries; } -size_t wxRegConfig::GetNumberOfGroups(bool bRecursive) const +size_t wxRegConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const { size_t nGroups = 0; @@ -691,34 +695,7 @@ bool wxRegConfig::RenameEntry(const wxString& oldName, const wxString& newName) if ( HasEntry(newName) ) return FALSE; - // delete the old entry and create the new one - but do in the reverse - // order to not lose the data if Create() fails - - bool ok; - if ( m_keyLocal.IsNumericValue(oldName) ) - { - long val; - ok = m_keyLocal.QueryValue(oldName, &val) && - m_keyLocal.SetValue(newName, val); - } - else - { - wxString val; - ok = m_keyLocal.QueryValue(oldName, val) && - m_keyLocal.SetValue(newName, val); - } - - if ( !ok ) - return FALSE; - - if ( !m_keyLocal.DeleteValue(oldName) ) - { - m_keyLocal.DeleteValue(newName); - - return FALSE; - } - - return TRUE; + return m_keyLocal.RenameValue(oldName, newName); } bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName) @@ -731,17 +708,13 @@ bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName) if ( HasGroup(newName) ) return FALSE; - // TODO there is no way to rename a registry key - we must do a deep copy - // ourselves - wxFAIL_MSG(wxT("Registry key renaming not implemented")); - - return FALSE; + return wxRegKey(m_keyLocal, oldName).Rename(newName); } // ---------------------------------------------------------------------------- // deleting // ---------------------------------------------------------------------------- -bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso) +bool wxRegConfig::DeleteEntry(const wxString& value, bool WXUNUSED(bGroupIfEmptyAlso)) { wxConfigPathChanger path(this, value);