From 99ef7f1cfcaa4ead4b860faec88754abbe31ebfc Mon Sep 17 00:00:00 2001 From: "admin@progandy.co.cc" Date: Mon, 13 Sep 2010 08:20:48 +0000 Subject: - fixed Folders code (thanks to CHEF-KOCH) git-svn-id: http://mirotr.googlecode.com/svn/trunk@11 eced67a3-f377-a0ae-92ae-d6de1850b05a --- MirOTR/options.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/MirOTR/options.cpp b/MirOTR/options.cpp index 175edb5..af0875d 100644 --- a/MirOTR/options.cpp +++ b/MirOTR/options.cpp @@ -19,6 +19,7 @@ struct PROTOREGENKEYOPTIONS { void SetFilenames(const char *path) { if (!path || !path[0]) return; + CallService(MS_UTILS_CREATEDIRTREE, 0, (LPARAM) path); strcpy(g_fingerprint_store_filename, path); strcpy(g_private_key_filename, path); strcat(g_fingerprint_store_filename, ("\\")); @@ -35,27 +36,29 @@ int FoldersChanged(WPARAM wParam, LPARAM lParam) { fgd.cbSize = sizeof(FOLDERSGETDATA); fgd.nMaxPathSize = MAX_PATH; fgd.szPath = path; - - CallService(MS_FOLDERS_GET_PATH, (LPARAM)hPATH_MIROTR, (LPARAM)&fgd); - SetFilenames(path); + if (CallService(MS_FOLDERS_GET_PATH, (LPARAM)hPATH_MIROTR, (LPARAM)&fgd)) { + char *mypath = Utils_ReplaceVars(DATA_DIRECTORY); + SetFilenames(mypath); + mir_free(mypath); + } else + SetFilenames(path); + ReadPrivkeyFiles(); return 0; } void LoadFilenames() { - char *path = Utils_ReplaceVars(DATA_DIRECTORY); - CallService(MS_UTILS_CREATEDIRTREE, 0, (LPARAM) path); - SetFilenames(path); - mir_free(path); - if(ServiceExists(MS_FOLDERS_REGISTER_PATH)) { - FoldersRegisterCustomPath(MODULENAME, "Private Data", DATA_DIRECTORY); + hPATH_MIROTR = FoldersRegisterCustomPath(MODULENAME, "Private Data", DATA_DIRECTORY); HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersChanged); // get the path - above are only defaults - there may be a different value in the db FoldersChanged(0, 0); } else { + char *path = Utils_ReplaceVars(DATA_DIRECTORY); + SetFilenames(path); + mir_free(path); ReadPrivkeyFiles(); } } -- cgit v1.2.3