summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2013-10-28 18:35:39 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2013-10-28 18:35:39 +0000
commit9a544494ea5dc8b9a41da6d38015e9c4a1a0f3a6 (patch)
tree580f3a56e8beca3125e2f23554bc66fba56ee615 /plugins/Db_autobackups
parentfe82414371277756f2612ba8542c4b23f5625917 (diff)
cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6662 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db_autobackups')
-rw-r--r--plugins/Db_autobackups/src/backup.cpp4
-rw-r--r--plugins/Db_autobackups/src/headers.h1
-rw-r--r--plugins/Db_autobackups/src/main.cpp21
-rw-r--r--plugins/Db_autobackups/src/options.cpp5
4 files changed, 6 insertions, 25 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index 59f65c6220..4e8f82f6af 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -130,15 +130,13 @@ int Backup(TCHAR* backup_filename)
if (backup_filename == NULL)
{
- int err = 0;
-
SYSTEMTIME st;
TCHAR buffer[MAX_COMPUTERNAME_LENGTH+1];
DWORD size = sizeof(buffer);
TCHAR *backupfolder = Utils_ReplaceVarsT(options.folder);
// ensure the backup folder exists (either create it or return non-zero signifying error)
- err = CreateDirectoryTree(backupfolder);
+ int err = CreateDirectoryTreeT(backupfolder);
if(err != ERROR_ALREADY_EXISTS && err != 0) {
return 1;
}
diff --git a/plugins/Db_autobackups/src/headers.h b/plugins/Db_autobackups/src/headers.h
index 0836239105..8195df1c36 100644
--- a/plugins/Db_autobackups/src/headers.h
+++ b/plugins/Db_autobackups/src/headers.h
@@ -32,7 +32,6 @@
void ShowPopup(TCHAR* text, TCHAR* header);
INT_PTR DBSaveAs(WPARAM wParam, LPARAM lParam);
INT_PTR ABService(WPARAM wParam, LPARAM lParam);
-int CreateDirectoryTree(TCHAR *szDir);
int Backup(TCHAR* backup_filename);
int SetBackupTimer(void);
int OptionsInit(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp
index dc6aea1c5d..097f7d54ee 100644
--- a/plugins/Db_autobackups/src/main.cpp
+++ b/plugins/Db_autobackups/src/main.cpp
@@ -67,9 +67,7 @@ static int ModulesLoad(WPARAM, LPARAM)
FoldersInit();
LoadOptions();
- MenuInit();
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
if(options.backup_types & BT_START)
mir_forkthread(BackupThread, NULL);
return 0;
@@ -94,7 +92,9 @@ void SysInit()
CreateServiceFunction(MS_AB_BACKUP, ABService);
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
-
+ MenuInit();
+
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
}
@@ -133,21 +133,6 @@ void ShowPopup(TCHAR* text, TCHAR* header)
PUAddPopupT(&ppd);
}
-int CreateDirectoryTree(TCHAR *szDir)
-{
- TCHAR szTestDir[MAX_PATH];
-
- lstrcpyn(szTestDir, szDir, SIZEOF(szTestDir));
- TCHAR *pszLastBackslash = _tcsrchr( szTestDir, '\\' );
- if ( pszLastBackslash == NULL )
- return 0;
-
- *pszLastBackslash = '\0';
- CreateDirectoryTree( szTestDir );
- *pszLastBackslash = '\\';
- return ( CreateDirectory( szTestDir, NULL ) == 0 ) ? GetLastError() : 0;
-}
-
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle)
{
HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index 02a2c2bc7f..0f63dc96de 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -299,8 +299,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
TCHAR backupfolder[MAX_PATH] = {0};
BOOL folder_ok = TRUE;
- int err = 0;
- TCHAR *tmp = Utils_ReplaceVarsT(folder_buff);
+ TCHAR *tmp = Utils_ReplaceVarsT(folder_buff);
if(_tcslen(tmp) >= 2 && tmp[1] == ':')
_tcsncpy(backupfolder, tmp, MAX_PATH-1);
@@ -308,7 +307,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
mir_sntprintf(backupfolder, MAX_PATH, _T("%s\\%s"), profilePath, tmp);
mir_free(tmp);
- err = CreateDirectoryTree(backupfolder);
+ int err = CreateDirectoryTreeT(backupfolder);
if(err != ERROR_ALREADY_EXISTS && err != 0) {
TCHAR msg_buff[512];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0);