-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
66 lines (48 loc) · 1.86 KB
/
main.cpp
File metadata and controls
66 lines (48 loc) · 1.86 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
60
61
62
63
64
65
66
#include "FUNCTIONS/backup_and_erase.h"
#include "FUNCTIONS/compute_files.h"
#include "FUNCTIONS/copy_paste.h"
#include "FUNCTIONS/get_user_dir.h"
#include "FUNCTIONS/json_ops.h"
#include "FUNCTIONS/list_files.h"
#include "FUNCTIONS/write_read_files.h"
int main() {
std::vector<fs::path> bases = read_data_and_tmp_dirs();
const fs::path data_base = bases.at(0);
const fs::path tmp_base = bases.at(1);
create_base_and_data_dirs();
const fs::path entry_dir_file = data_base / "source_dirs.txt";
const fs::path backup_dir_file = data_base / "backup_dir.txt";
// const fs::path entry_dir_file = data_base / "test_source_dirs.txt";
// const fs::path backup_dir_file = data_base / "test_backup_dir.txt";
const fs::path all_backed_up_files = data_base / tmp_base / "backup_files.txt";
const fs::path to_backup_file = data_base / tmp_base / "to_backup_file.json";
const fs::path to_erase_file = data_base / tmp_base / "to_erase_file.txt";
// Initialization of GTK
int argc = 0;
char **argv = nullptr;
gtk_init(&argc, &argv);
// ADDING NEW DIR TO BACKUP LOGIC, MODIFY AFTER TO AVOID BUGS OF CHOICE
std::unordered_set<fs::path> source_dirs = get_to_backup_folders(entry_dir_file);
// LOGIC TO GET THE DESTINATION OF THE SAVED FILES (ONLY ONE PATH)
fs::path backup_dir = get_backup_folder(backup_dir_file);
create_files(
backup_dir,
source_dirs,
to_erase_file,
to_backup_file,
true, // CHECK MODIFICATION DATES
true // REMOVE DELETED FILES ON PHONE FROM BACKUP
);
backup(
to_backup_file,
to_erase_file,
backup_dir
);
erase(
to_erase_file,
to_backup_file,
backup_dir
);
remove_tmp_files(data_base / tmp_base);
return 0;
}