+ if ( !file.Commit() )
+ {
+ wxLogError(_("Failed to update user configuration file."));
+
+ return false;
+ }
+
+ ResetDirty();
+
+#if defined(__WXMAC__)
+ wxFileName(m_strLocalFile).MacSetTypeAndCreator('TEXT', 'ttxt');
+#endif // __WXMAC__
+
+ return true;
+}
+
+#if wxUSE_STREAMS
+
+bool wxFileConfig::Save(wxOutputStream& os, wxMBConv& conv)
+{
+ // save unconditionally, even if not dirty
+ for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() )
+ {
+ wxString line = p->Text();
+ line += wxTextFile::GetEOL();
+ if ( !os.Write(line.mb_str(conv), line.length()) )
+ {
+ wxLogError(_("Error saving user configuration data."));
+
+ return false;
+ }
+ }
+
+ ResetDirty();
+
+ return true;
+}
+
+#endif // wxUSE_STREAMS
+
+// ----------------------------------------------------------------------------
+// renaming groups/entries
+// ----------------------------------------------------------------------------
+
+bool wxFileConfig::RenameEntry(const wxString& oldName,
+ const wxString& newName)
+{
+ wxASSERT_MSG( !wxStrchr(oldName, wxCONFIG_PATH_SEPARATOR),
+ _T("RenameEntry(): paths are not supported") );
+
+ // check that the entry exists
+ wxFileConfigEntry *oldEntry = m_pCurrentGroup->FindEntry(oldName);
+ if ( !oldEntry )
+ return false;
+
+ // check that the new entry doesn't already exist
+ if ( m_pCurrentGroup->FindEntry(newName) )
+ return false;
+
+ // delete the old entry, create the new one
+ wxString value = oldEntry->Value();
+ if ( !m_pCurrentGroup->DeleteEntry(oldName) )
+ return false;
+
+ SetDirty();
+
+ wxFileConfigEntry *newEntry = m_pCurrentGroup->AddEntry(newName);
+ newEntry->SetValue(value);
+
+ return true;
+}
+
+bool wxFileConfig::RenameGroup(const wxString& oldName,
+ const wxString& newName)
+{
+ // check that the group exists
+ wxFileConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName);
+ if ( !group )
+ return false;
+
+ // check that the new group doesn't already exist
+ if ( m_pCurrentGroup->FindSubgroup(newName) )
+ return false;
+
+ group->Rename(newName);
+
+ SetDirty();
+
+ return true;