mirror of
https://github.com/cmderdev/cmder.git
synced 2025-01-10 08:19:08 +08:00
Merge pull request #2988 from daxgames/fix_launcher_overwrite-2
Development BUG - Fixes launcher overwriting or not backing up terminal emulator settings in development branch.
This commit is contained in:
commit
15d56185b7
@ -1,5 +1,11 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- Fixes #2940
|
||||||
|
|
||||||
## [1.3.20](https://github.com/cmderdev/cmder/tree/v1.3.20) (2022-03-18)
|
## [1.3.20](https://github.com/cmderdev/cmder/tree/v1.3.20) (2022-03-18)
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
@ -289,57 +289,60 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
// Set path to Cmder user ConEmu config file
|
// Set path to Cmder user ConEmu config file
|
||||||
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wcscmp(cpuCfgPath, L"") == 0 && (PathFileExists(cpuCfgPath) || use_user_cfg == false)) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config.
|
if (wcscmp(cpuCfgPath, L"") != 0 && (PathFileExists(cpuCfgPath) || use_user_cfg == false)) // config/[host specific terminal emulator config] file exists or /m was specified on command line, use machine specific config.
|
||||||
{
|
{
|
||||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
{
|
{
|
||||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
if (PathFileExists(cfgPath)) // [terminal emulator config] file exists, copy [terminal emulator config] to config/user_[terminal emulator config] file to backup any settings changes from previous sessions.
|
||||||
{
|
{
|
||||||
if (PathFileExists(windowsTerminalDir)) {
|
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||||
MessageBox(NULL,
|
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
|
||||||
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_%COMPUTERNAME%_settings.json! Access Denied."
|
|
||||||
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_%COMPUTERNAME%_settigns.json!", MB_TITLE, MB_ICONSTOP);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else if (PathFileExists(conEmuDir))
|
|
||||||
{
|
{
|
||||||
MessageBox(NULL,
|
if (PathFileExists(windowsTerminalDir)) {
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
MessageBox(NULL,
|
||||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_%COMPUTERNAME%_settings.json! Access Denied."
|
||||||
exit(1);
|
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_%COMPUTERNAME%_settigns.json!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else if (PathFileExists(conEmuDir))
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
|
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||||
|
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else // [terminal emulator config] file does not exist, copy config/[host specific terminal emulator config] file to [terminal emulator config] file
|
||||||
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
|
||||||
{
|
|
||||||
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
|
||||||
{
|
{
|
||||||
if (PathFileExists(windowsTerminalDir)) {
|
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
||||||
MessageBox(NULL,
|
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
|
||||||
? L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
|
|
||||||
: L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else if (PathFileExists(conEmuDir))
|
|
||||||
{
|
{
|
||||||
MessageBox(NULL,
|
if (PathFileExists(windowsTerminalDir)) {
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
MessageBox(NULL,
|
||||||
? L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
? L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
|
||||||
exit(1);
|
: L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else if (PathFileExists(conEmuDir))
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
|
? L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||||
|
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wcscmp(userCfgPath, L"") == 0 && PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
|
else if (wcscmp(userCfgPath, L"") != 0 && PathFileExists(userCfgPath)) // config/user[terminal emulator config] file exists, use it.
|
||||||
{
|
{
|
||||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
{
|
{
|
||||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
|
if (PathFileExists(cfgPath)) // [terminal emulator config] file exists, copy [terminal emulator config] to config/user_[terminal emulator config] file to backup any settings changes from previous sessions.
|
||||||
{
|
{
|
||||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||||
{
|
{
|
||||||
@ -360,7 +363,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
else // [terminal emulator config] file does not exist, copy config/user_[terminal emulator config] file to [terminal emulator config] file
|
||||||
{
|
{
|
||||||
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
||||||
{
|
{
|
||||||
@ -382,13 +385,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!PathFileExists(windowsTerminalDir)) { // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu.
|
else if (!PathFileExists(windowsTerminalDir)) { // '/c [path]' was specified, don't copy anything and use existing user_[terminal emulator config] file.
|
||||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
else if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
{
|
{
|
||||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
|
if (PathFileExists(cfgPath)) // [terminal emulator config] file exists, copy [terminal emulator config] file to config/user_[terminal emulator config] file.
|
||||||
{
|
{
|
||||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||||
{
|
{
|
||||||
@ -408,7 +411,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml.
|
else // vendor/[terminal emulator config].default config exists, copy Cmder vendor/[terminal emulator config].default file to [terminal emulator config] file.
|
||||||
{
|
{
|
||||||
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||||
{
|
{
|
||||||
@ -436,10 +439,10 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wcscmp(cfgPath, L"") == 0 && PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
|
else if (wcscmp(cfgPath, L"") != 0 && PathFileExists(cfgPath)) // This is a first time Cmder.exe run and [terminal emulator config] file exists, copy [terminal emulator config] file to config/user_[terminal emulator config] file.
|
||||||
{
|
{
|
||||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||||
{
|
{
|
||||||
@ -462,7 +465,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
|
|
||||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
}
|
}
|
||||||
else if (wcscmp(defaultCfgPath, L"") == 0) // '/c [path]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'.
|
else if (wcscmp(defaultCfgPath, L"") != 0) // '/c [path]' was specified and 'vendor/[terminal emulator config].default' config exists, copy Cmder 'vendor/[terminal emulator config].default' file to '[user specified path]/config/user_[terminal emulator config]'.
|
||||||
{
|
{
|
||||||
if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE))
|
if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user