diff options
Diffstat (limited to 'protocols/Tox/src/tox_profile.cpp')
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 4ee3abc526..898899bff1 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -18,11 +18,16 @@ std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName) bool CToxProto::LoadToxProfile()
{
std::tstring profilePath = GetToxProfilePath();
+ if (!IsFileExists(profilePath))
+ {
+ return true;
+ }
+
FILE *profile = _tfopen(profilePath.c_str(), _T("rb"));
if (profile == NULL)
{
debugLogA("CToxProto::LoadToxData: could not open tox profile");
- return true;
+ return false;
}
fseek(profile, 0, SEEK_END);
@@ -84,7 +89,7 @@ bool CToxProto::LoadToxProfile() void CToxProto::SaveToxProfile()
{
- size_t size = 0;
+ /*size_t size = 0;
uint8_t *data = NULL;
{
@@ -107,7 +112,11 @@ void CToxProto::SaveToxProfile() data = (uint8_t*)mir_calloc(size);
tox_save(tox, data);
}
- }
+ }*/
+
+ size_t size = tox_size(tox);
+ uint8_t *data = (uint8_t*)mir_calloc(size);
+ tox_save(tox, data);
std::tstring profilePath = GetToxProfilePath();
FILE *profile = _tfopen(profilePath.c_str(), _T("wb"));
|