From 6ac39390bcfe21275c29721fff0c78158c14abb2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Jun 2024 19:25:19 +0300 Subject: =?UTF-8?q?fixes=20#4454=20(Msg=5FExport:=20=D0=BF=D0=BB=D0=B0?= =?UTF-8?q?=D0=B3=D0=B8=D0=BD=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D1=83=D0=B5=D1=82=20=D0=BD=D0=B5=D1=81=D1=82=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D0=B0=D1=80=D1=82=D0=BD=D1=83=D1=8E=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BD=D1=83=D1=8E=20%dbpath%)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Msg_Export/src/main.cpp | 1 - plugins/Msg_Export/src/options.cpp | 4 ++-- plugins/Msg_Export/src/stdafx.h | 1 - plugins/Msg_Export/src/utils.cpp | 40 +------------------------------------- plugins/Msg_Export/src/utils.h | 1 - 5 files changed, 3 insertions(+), 44 deletions(-) (limited to 'plugins/Msg_Export/src') diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 7f78b1eeb9..5b43b06505 100644 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -87,7 +87,6 @@ static int OnModuleLoaded(WPARAM, LPARAM) int MainInit(WPARAM, LPARAM) { - bReadMirandaDirAndPath(); OnModuleLoaded(0, 0); UpdateFileToColWidth(); diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index e56c619679..47b81be3f8 100644 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -867,9 +867,9 @@ public: void onClick_Debug(CCtrlButton*) { wstring sDebug = L"Debug information\r\nsDBPath :"; - sDebug += g_sDBPath; + sDebug += VARSW(L"%miranda_userdata%").get(); sDebug += L"\r\nsMirandaPath :"; - sDebug += g_sMirandaPath; + sDebug += VARSW(L"%miranda_path%").get(); sDebug += L"\r\nsDefaultFile :"; sDebug += g_sDefaultFile; diff --git a/plugins/Msg_Export/src/stdafx.h b/plugins/Msg_Export/src/stdafx.h index a914349564..528989ffa0 100644 --- a/plugins/Msg_Export/src/stdafx.h +++ b/plugins/Msg_Export/src/stdafx.h @@ -73,7 +73,6 @@ struct CMPlugin : public PLUGIN }; extern MWindowList hInternalWindowList; -extern wstring g_sDBPath, g_sMirandaPath; /////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 69ca452030..97bae746d1 100644 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -34,12 +34,6 @@ wstring g_sExportDir; // The default filename. Used if no other file name is specified in DB. wstring g_sDefaultFile; -// path used then %dbpath% is used in export file path -wstring g_sDBPath = pszDbPathError; - -// path to miranda exe file used when to avoid relative paths -wstring g_sMirandaPath = pszDbPathError; - // Used to store the width of the user name for a file. // if a file contains events from many users the one user name // may be shorter. so to make all event have the same first @@ -223,29 +217,6 @@ wchar_t* GetMyOwnNick(MCONTACT hContact) return (p != nullptr) ? p : mir_wstrdup(TranslateT("No_Nick")); } -///////////////////////////////////////////////////////////////////// -// Member Function : bReadMirandaDirAndPath -// Type : Global -// Parameters : None -// Returns : void -// Description : Used to set the internal path. -// Handles the reading from the mirandaboot.ini to get the %dbpath% - -bool bReadMirandaDirAndPath() -{ - wchar_t szDBPath[MAX_PATH], tmp[MAX_PATH]; - wcsncpy_s(szDBPath, pszDbPathError, _TRUNCATE); - PathToAbsoluteW(L"miranda32.exe", tmp); - g_sMirandaPath = tmp; - g_sMirandaPath.erase(g_sMirandaPath.find_last_of(L"\\")); - Profile_GetPathW(MAX_PATH, szDBPath); - g_sDBPath = szDBPath; - Profile_GetNameW(MAX_PATH, szDBPath); - g_sDBPath.append(L"\\").append(szDBPath); - g_sDBPath.erase(g_sDBPath.size() - 4); - return true; -} - ///////////////////////////////////////////////////////////////////// // Member Function : ReplaceDBPath // Type : Global @@ -253,18 +224,9 @@ bool bReadMirandaDirAndPath() void ReplaceDBPath(wstring &sRet) { - ReplaceAll(sRet, L"%dbpath%", g_sDBPath); - // Try to figure out if it is a relative path ( ..\..\MsgExport\ ) - if (sRet.size() <= 2 || !(sRet[1] == ':' || - (sRet[0] == '\\' && sRet[1] == '\\'))) { - // Relative path - // we will prepend the mirande exe path to avoid problems - // if the current directory changes ( User receives a file ) - sRet = g_sMirandaPath + sRet; - } + ReplaceAll(sRet, L"%dbpath%", VARSW(L"%miranda_userdata%")); } - ///////////////////////////////////////////////////////////////////// // Member Function : GetFilePathFromUser // Type : Global diff --git a/plugins/Msg_Export/src/utils.h b/plugins/Msg_Export/src/utils.h index 2e10273cda..19a31de5b4 100644 --- a/plugins/Msg_Export/src/utils.h +++ b/plugins/Msg_Export/src/utils.h @@ -56,7 +56,6 @@ wstring __inline _DBGetStringW(MCONTACT hContact, const char *szModule, const ch void UpdateFileToColWidth(); -bool bReadMirandaDirAndPath(); wstring GetFilePathFromUser(MCONTACT hContact); void ReplaceDefines(MCONTACT hContact, wstring &sTarget); -- cgit v1.2.3