summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-01-09 20:54:59 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-01-09 20:54:59 +0300
commitf79400bdcfdade258a9070de2b9a433c86cac588 (patch)
tree2085fb986c2fa6475b5d1257f5e82ac392b082db /src
parent76d126fb1e313ff2731adb7ba48ac00b3aa0eb5e (diff)
fix for moving autoexec_* files
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/db_ini.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp
index a164e9eb83..99096afb50 100644
--- a/src/mir_app/src/db_ini.cpp
+++ b/src/mir_app/src/db_ini.cpp
@@ -28,6 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static bool bModuleInitialized = false;
static HANDLE hIniChangeNotification;
+static void MyMoveFile(const wchar_t *pwszFrom, const wchar_t *pwszTo)
+{
+ if (PU::PrepareEscalation())
+ PU::SafeMoveFile(pwszFrom, pwszTo);
+}
+
static void MyDeleteFile(const wchar_t *pwszFileName)
{
if (PU::PrepareEscalation())
@@ -233,7 +239,7 @@ protected:
void Move_OnClick(CCtrlBase*)
{
- MoveFile(ptrW(m_iniPath.GetText()), ptrW(m_newPath.GetText()));
+ MyMoveFile(ptrW(m_iniPath.GetText()), ptrW(m_newPath.GetText()));
Close();
}
@@ -559,12 +565,10 @@ static void DoAutoExec(void)
ToRecycleBin(szIniPath);
}
else if (!mir_wstrcmpi(szOnCompletion, L"rename")) {
- wchar_t szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
- Profile_GetSetting(L"AutoExec/RenamePrefix", szRenamePrefix, L"done_");
- mir_wstrcpy(szNewPath, szFindPath);
- mir_wstrcat(szNewPath, szRenamePrefix);
- mir_wstrcat(szNewPath, fd.cFileName);
- MoveFile(szIniPath, szNewPath);
+ wchar_t wszRenamePrefix[MAX_PATH], wszNewPath[MAX_PATH];
+ Profile_GetSetting(L"AutoExec/RenamePrefix", wszRenamePrefix, L"done_");
+ mir_snwprintf(wszNewPath, L"%s%s%s", szFindPath, wszRenamePrefix, fd.cFileName);
+ MyMoveFile(szIniPath, wszNewPath);
}
else if (!mir_wstrcmpi(szOnCompletion, L"ask")) {
CIniImportDoneDlg dlg(szIniPath);