From a4f6e25737b0404ba91fb77840aefa82cfc76fb0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 30 May 2019 21:58:10 +0300 Subject: SmileyAdd: more reasonable default values for Folders --- plugins/SmileyAdd/src/download.cpp | 6 +++--- plugins/SmileyAdd/src/options.cpp | 2 +- plugins/SmileyAdd/src/smileys.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 17a203bc68..206f2f45b1 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -220,7 +220,7 @@ bool GetSmileyFile(CMStringW &url, const CMStringW &packstr) int FolderChanged(WPARAM, LPARAM) { FoldersGetCustomPathT(hFolderCache, g_wszCachePath, MAX_PATH, L""); - FoldersGetCustomPathT(hFolderPacks, g_plugin.wszDefaultPath, MAX_PATH, L"Smileys"); + FoldersGetCustomPathT(hFolderPacks, g_plugin.wszDefaultPath, MAX_PATH, L"%miranda_path%"); size_t len = mir_wstrlen(g_plugin.wszDefaultPath); if (len && g_plugin.wszDefaultPath[len - 1] != '\\') mir_wstrcpy(g_plugin.wszDefaultPath + len, L"\\"); @@ -235,7 +235,7 @@ void DownloadInit(void) nlu.szDescriptiveName.w = TranslateT("SmileyAdd HTTP connections"); hNetlibUser = Netlib_RegisterUser(&nlu); - hFolderPacks = FoldersRegisterCustomPathT(LPGEN("SmileyAdd"), LPGEN("Smiley packs' folder"), L"Smileys"); + hFolderPacks = FoldersRegisterCustomPathT(LPGEN("SmileyAdd"), LPGEN("Smiley packs' folder"), L"%miranda_path%"); if (hFolderPacks) { hFolderCache = FoldersRegisterCustomPathT(LPGEN("SmileyAdd"), LPGEN("Smiley cache"), MIRANDA_USERDATAT L"\\SmileyCache"); FolderChanged(0, 0); @@ -243,7 +243,7 @@ void DownloadInit(void) } else { wcsncpy_s(g_wszCachePath, VARSW(L"%miranda_userdata%\\SmileyCache"), _TRUNCATE); - wcsncpy_s(g_plugin.wszDefaultPath, L"Smileys", _TRUNCATE); + g_plugin.wszDefaultPath[0] = 0; } g_hDlMutex = CreateMutex(nullptr, FALSE, nullptr); diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 3a857a49bd..6a31209c0f 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -75,7 +75,7 @@ void OptionsType::ReadPackFileName(CMStringW &filename, const CMStringW &name, c filename = tszValue; else { if (defaultFilename.IsEmpty()) - filename.Format(L"%s\\nova\\default.msl", g_plugin.wszDefaultPath); + filename.Format(L"%s\\Smileys\\nova\\default.msl", g_plugin.wszDefaultPath); else filename = defaultFilename; } diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 62621fd297..904635102c 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -353,7 +353,7 @@ bool SmileyPackType::LoadSmileyFile(const CMStringW &filename, const CMStringW & CMStringW modpath = VARSW(filename); if (_waccess(modpath, 4) != 0) { wchar_t wszTmp[MAX_PATH]; - PathToAbsoluteW(filename, wszTmp, g_plugin.wszDefaultPath); + PathToAbsoluteW(filename, wszTmp, g_plugin.wszDefaultPath[0] ? g_plugin.wszDefaultPath : nullptr); if (_waccess(wszTmp, 4) != 0) { if (!noerr) { static const wchar_t errmsg[] = LPGENW("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys."); @@ -825,7 +825,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr packnam = "MSN"; wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\nova\\%S.msl", g_plugin.wszDefaultPath, packnam); + mir_snwprintf(path, L"%s\\Smileys\\nova\\%S.msl", g_plugin.wszDefaultPath, packnam); if (_waccess(path, 0) != 0) paths = defaultFile; } @@ -847,7 +847,7 @@ void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMStringW &defa packnam = "MSN"; // assemble default path - CMStringW paths(FORMAT, L"%s\\nova\\%S.msl", g_plugin.wszDefaultPath, packnam); + CMStringW paths(FORMAT, L"%s\\Smileys\\nova\\%S.msl", g_plugin.wszDefaultPath, packnam); paths = VARSW(paths); if (_waccess(paths.c_str(), 0) != 0) paths = defaultFile; @@ -916,7 +916,7 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co CMStringW paths, displayName(dbv.pwszVal); if (packname != nullptr) { - paths.Format(L"%s\\nova\\%S.msl", g_plugin.wszDefaultPath, packname); + paths.Format(L"%s\\Smileys\\nova\\%S.msl", g_plugin.wszDefaultPath, packname); paths = VARSW(paths); if (_waccess(paths.c_str(), 0) != 0) paths = defaultFile; -- cgit v1.2.3