-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathffilesync.cpp
More file actions
61 lines (40 loc) · 1.18 KB
/
ffilesync.cpp
File metadata and controls
61 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <QDateTime>
#include "ffilesync.h"
enum SyncDirection {SrcToTrgt, TrgtToSrc};
bool FFileSync::sync(QDir local, int numBckps)
{
QDateTime latestSync_local;
QDateTime latestSync_synced;
bool syncPossible = true;
QDir synced; // = db->getSavegameDir();
if (!local.exists())
throw FException("Source does not Exist!\n" + local.absolutePath());
if (!synced.exists())
throw FException("Target does not Exist!\n" + synced.absolutePath());
if (numBckps < 0)
throw FException("Invalid Backup-Number!\nBackups: " + synced.absolutePath());
QFile info_local(local.absoluteFilePath("f_sync.info"));
QFile info_synced(synced.absoluteFilePath("f_sync.info"));
if (!info_local.exists())
{
//qDebug() << "Never synced Source.";
syncPossible = false;
}
else
{
latestSync_local = QDateTime::fromString(info_local.readAll());
}
if (!info_synced.exists())
{
// qDebug() << "Never synced Target.";
syncPossible = false;
}
else
{
latestSync_synced = QDateTime::fromString(info_synced.readAll());
}
if(syncPossible)
{
}
return true;
}