mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-13 01:20:22 +03:00
* RouterInfo::SaveToFile() now returns bool
This commit is contained in:
parent
f63dd75f08
commit
5f73f09836
@ -514,19 +514,20 @@ namespace data
|
|||||||
m_BufferLen += privateKeys.GetPublic ()->GetSignatureLen ();
|
m_BufferLen += privateKeys.GetPublic ()->GetSignatureLen ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterInfo::SaveToFile (const std::string& fullPath)
|
bool RouterInfo::SaveToFile (const std::string& fullPath)
|
||||||
{
|
{
|
||||||
m_FullPath = fullPath;
|
m_FullPath = fullPath;
|
||||||
if (m_Buffer)
|
if (!m_Buffer) {
|
||||||
{
|
|
||||||
std::ofstream f (fullPath, std::ofstream::binary | std::ofstream::out);
|
|
||||||
if (f.is_open ())
|
|
||||||
f.write ((char *)m_Buffer, m_BufferLen);
|
|
||||||
else
|
|
||||||
LogPrint(eLogError, "RouterInfo: Can't save to ", fullPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LogPrint (eLogError, "RouterInfo: Can't save, m_Buffer == NULL");
|
LogPrint (eLogError, "RouterInfo: Can't save, m_Buffer == NULL");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::ofstream f (fullPath, std::ofstream::binary | std::ofstream::out);
|
||||||
|
if (!f.is_open ()) {
|
||||||
|
LogPrint(eLogError, "RouterInfo: Can't save to ", fullPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
f.write ((char *)m_Buffer, m_BufferLen);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RouterInfo::ReadString (char * str, std::istream& s)
|
size_t RouterInfo::ReadString (char * str, std::istream& s)
|
||||||
|
@ -161,7 +161,7 @@ namespace data
|
|||||||
|
|
||||||
bool IsUpdated () const { return m_IsUpdated; };
|
bool IsUpdated () const { return m_IsUpdated; };
|
||||||
void SetUpdated (bool updated) { m_IsUpdated = updated; };
|
void SetUpdated (bool updated) { m_IsUpdated = updated; };
|
||||||
void SaveToFile (const std::string& fullPath);
|
bool SaveToFile (const std::string& fullPath);
|
||||||
|
|
||||||
std::shared_ptr<RouterProfile> GetProfile () const;
|
std::shared_ptr<RouterProfile> GetProfile () const;
|
||||||
void SaveProfile () { if (m_Profile) m_Profile->Save (); };
|
void SaveProfile () { if (m_Profile) m_Profile->Save (); };
|
||||||
|
Loading…
Reference in New Issue
Block a user