mirror of
https://github.com/cmderdev/cmder.git
synced 2025-02-11 07:59:07 +08:00
added backup of ConEmu.xml to ./config/user-ConEmu.xml at cmder launch if it exists
This commit is contained in:
parent
abd7db99b6
commit
5feccb3c7c
@ -103,6 +103,7 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
wchar_t exeDir[MAX_PATH] = { 0 };
|
wchar_t exeDir[MAX_PATH] = { 0 };
|
||||||
wchar_t icoPath[MAX_PATH] = { 0 };
|
wchar_t icoPath[MAX_PATH] = { 0 };
|
||||||
wchar_t cfgPath[MAX_PATH] = { 0 };
|
wchar_t cfgPath[MAX_PATH] = { 0 };
|
||||||
|
wchar_t backupCfgPath[MAX_PATH] = { 0 };
|
||||||
wchar_t cpuCfgPath[MAX_PATH] = { 0 };
|
wchar_t cpuCfgPath[MAX_PATH] = { 0 };
|
||||||
wchar_t userCfgPath[MAX_PATH] = { 0 };
|
wchar_t userCfgPath[MAX_PATH] = { 0 };
|
||||||
wchar_t oldCfgPath[MAX_PATH] = { 0 };
|
wchar_t oldCfgPath[MAX_PATH] = { 0 };
|
||||||
@ -127,12 +128,15 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
|
|
||||||
if (PathFileExists(cpuCfgPath)) {
|
if (PathFileExists(cpuCfgPath)) {
|
||||||
wcsncpy_s(oldCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
wcsncpy_s(oldCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
||||||
|
wcsncpy_s(backupCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
||||||
}
|
}
|
||||||
else if (PathFileExists(userCfgPath)) {
|
else if (PathFileExists(userCfgPath)) {
|
||||||
wcsncpy_s(oldCfgPath, userCfgPath,sizeof(userCfgPath));
|
wcsncpy_s(oldCfgPath, userCfgPath,sizeof(userCfgPath));
|
||||||
|
wcsncpy_s(backupCfgPath, userCfgPath, sizeof(userCfgPath));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PathCombine(oldCfgPath, exeDir, L"config\\ConEmu.xml");
|
PathCombine(oldCfgPath, exeDir, L"config\\ConEmu.xml");
|
||||||
|
wcsncpy_s(backupCfgPath, userCfgPath, sizeof(userCfgPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set path to vendored ConEmu config file
|
// Set path to vendored ConEmu config file
|
||||||
@ -158,15 +162,13 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (!CopyFile(cfgPath, backupCfgPath, FALSE))
|
||||||
if (!CopyFile(cfgPath, oldCfgPath, FALSE))
|
{
|
||||||
{
|
MessageBox(NULL,
|
||||||
MessageBox(NULL,
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
? L"Failed to backup ConEmu.xml file to ./config folder!"
|
||||||
? L"Failed to backup ConEmu.xml file to ./config folder!"
|
: L"Failed to backup ConEmu.xml file to ./config folder!", MB_TITLE, MB_ICONSTOP);
|
||||||
: L"Failed to backup ConEmu.xml file to ./config folder!", MB_TITLE, MB_ICONSTOP);
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_single_mode)
|
if (is_single_mode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user