summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups/src/main.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-02-24 01:22:45 +0300
committeraunsane <aunsane@gmail.com>2018-02-24 01:22:45 +0300
commitb2eb0ef7a0f7f2b2bae0a48966038a673701df21 (patch)
treea4d9dae9fd0af1fbfbfaf3e70034b7f5ea788dd0 /plugins/Db_autobackups/src/main.cpp
parent1785dc55c0a4cdcbc5f9788e0196e7d3a38fe53c (diff)
Db_autobackups: Reworking settings of DB Autobackup (#1144)
Diffstat (limited to 'plugins/Db_autobackups/src/main.cpp')
-rw-r--r--plugins/Db_autobackups/src/main.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp
index 9aa48d8c6d..561e31dfeb 100644
--- a/plugins/Db_autobackups/src/main.cpp
+++ b/plugins/Db_autobackups/src/main.cpp
@@ -2,7 +2,6 @@
int hLangpack;
HINSTANCE g_hInstance;
-wchar_t *profilePath;
HANDLE hFolder;
char g_szMirVer[100];
@@ -80,13 +79,18 @@ static int ModulesLoad(WPARAM, LPARAM)
mi.position = 500100001;
Menu_AddMainMenuItem(&mi);
- profilePath = Utils_ReplaceVarsW(L"%miranda_userdata%");
-
if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
FoldersGetBackupPath(0, 0);
}
- options.use_dropbox = (BOOL)(db_get_b(0, "AutoBackups", "UseDropbox", 0) && ServiceExists(MS_DROPBOX_UPLOAD));
+ else {
+ DBVARIANT dbv;
+ if (!db_get_ws(0, MODULE, "Folder", &dbv)) {
+ wcsncpy_s(options.folder, dbv.ptszVal, _TRUNCATE);
+ db_free(&dbv);
+ }
+ else mir_snwprintf(options.folder, L"%s%s", DIR, SUB_DIR);
+ }
if (options.backup_types & BT_START)
BackupStart(nullptr);
@@ -124,7 +128,8 @@ extern "C" __declspec(dllexport) int Load(void)
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
HookEvent(ME_OPT_INITIALISE, OptionsInit);
- LoadOptions();
+
+ SetBackupTimer();
return 0;
}