From 5ff7a88046832332d9e482d9fc3540933f9f81d0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Jun 2024 19:14:25 +0300 Subject: =?UTF-8?q?fixes=20#4456=20(Msg=5FExport=20=D0=BD=D0=B5=D0=BA?= =?UTF-8?q?=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=BE=20=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=8F=D0=B5=D1=82=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Msg_Export/src/utils.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 36210a760b..69ca452030 100644 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -271,6 +271,14 @@ void ReplaceDBPath(wstring &sRet) // Parameters : hContact - Handle to user // Returns : string containing the complete file name and path +static bool CompareNoExt(const wstring &s1, const wstring &s2) +{ + wstring t1(s1), t2(s2); + ReplaceAll(t1, L".txt.json", L".txt"); + ReplaceAll(t2, L".txt.json", L".txt"); + return t1 == t2; +} + wstring GetFilePathFromUser(MCONTACT hContact) { wstring sFilePath = g_sExportDir + _DBGetStringW(hContact, MODULENAME, "FileName", g_sDefaultFile.c_str()); @@ -288,7 +296,7 @@ wstring GetFilePathFromUser(MCONTACT hContact) // Previous file name check to see if it has changed !! wstring sPrevFileName = _DBGetStringW(hContact, MODULENAME, "PrevFileName", L""); - if (sNoDBPath != sPrevFileName) { + if (!CompareNoExt(sNoDBPath, sPrevFileName)) { if (!sPrevFileName.empty()) { ReplaceDBPath(sPrevFileName); @@ -299,9 +307,7 @@ wstring GetFilePathFromUser(MCONTACT hContact) // file name has changed if (g_enRenameAction != eDANothing) { - - // we can not use FILE_SHARE_DELETE because this is not supported by - // win 98 / ME + // we can not use FILE_SHARE_DELETE because this is not supported by win 98 / ME HANDLE hPrevFile = CreateFile(sPrevFileName.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hPrevFile != INVALID_HANDLE_VALUE) { CloseHandle(hPrevFile); -- cgit v1.2.3