diff options
author | admin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a> | 2010-09-13 08:20:48 +0000 |
---|---|---|
committer | admin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a> | 2010-09-13 08:20:48 +0000 |
commit | 99ef7f1cfcaa4ead4b860faec88754abbe31ebfc (patch) | |
tree | 184c6fcadefdb97704818418f43d7d9f09309c43 /MirOTR | |
parent | 9832446d4b9476acfb3b5fc63d3b8f3d54f398b8 (diff) |
- fixed Folders code (thanks to CHEF-KOCH)
git-svn-id: http://mirotr.googlecode.com/svn/trunk@11 eced67a3-f377-a0ae-92ae-d6de1850b05a
Diffstat (limited to 'MirOTR')
-rw-r--r-- | MirOTR/options.cpp | 21 |
1 files 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();
}
}
|