Fix #624: Can´t rename network via webinterface

This commit is contained in:
J-P Nurmi
2014-08-19 20:59:19 +02:00
parent 0065506ff6
commit 2e42f3103c
5 changed files with 36 additions and 24 deletions

View File

@@ -221,6 +221,22 @@ bool CModule::SaveRegistry() const {
return (m_mssRegistry.WriteToDisk(GetSavePath() + "/.registry", 0600) == MCString::MCS_SUCCESS);
}
bool CModule::MoveRegistry(const CString& sPath) {
if (m_sSavePath != sPath) {
CFile fOldNVFile = CFile(m_sSavePath + "/.registry");
if (!fOldNVFile.Exists()) {
return false;
}
if (!CFile::Exists(sPath) && !CDir::MakeDir(sPath)) {
return false;
}
fOldNVFile.Copy(sPath + "/.registry");
m_sSavePath = sPath;
return true;
}
return false;
}
bool CModule::SetNV(const CString & sName, const CString & sValue, bool bWriteToDisk) {
m_mssRegistry[sName] = sValue;
if (bWriteToDisk) {