fix the bug with the current path being restored if it was under the group being deleted with DeleteGroup(); clarify what happens in this case in the docs

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-07-14 22:08:43 +00:00
parent 20eebe1aa8
commit 41f3015283
4 changed files with 34 additions and 4 deletions

View File

@@ -274,6 +274,21 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer,
}
}
void wxConfigPathChanger::UpdateIfDeleted()
{
// we don't have to do anything at all if we didn't change the path
if ( !m_bChanged )
return;
// find the deepest still existing parent path of the original path
while ( !m_pContainer->HasGroup(m_strOldPath) )
{
m_strOldPath = m_strOldPath.BeforeLast(wxCONFIG_PATH_SEPARATOR);
if ( m_strOldPath.empty() )
m_strOldPath = wxCONFIG_PATH_SEPARATOR;
}
}
wxConfigPathChanger::~wxConfigPathChanger()
{
// only restore path if it was changed