mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
Merge branch 'fix'
This commit is contained in:
commit
ddbfd1da18
@ -186,76 +186,84 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml");
|
||||
|
||||
// Set path to Cmder default ConEmu config file
|
||||
PathCombine(defaultCfgPath, exeDir, L"config\\ConEmu.xml");
|
||||
PathCombine(defaultCfgPath, exeDir, L"vendor\\ConEmu.xml.default");
|
||||
|
||||
// Check for machine-specific then user config source file.
|
||||
PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml");
|
||||
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
|
||||
|
||||
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
if (PathFileExists(cpuCfgPath)) {
|
||||
if (PathFileExists(cfgPath)) {
|
||||
|
||||
if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it.
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||
{
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location! Restart Cmder as Administrator."
|
||||
: L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location!", MB_TITLE, MB_ICONSTOP);
|
||||
? 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
|
||||
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))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator."
|
||||
: L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP);
|
||||
? L"Failed to copy conig/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 (PathFileExists(userCfgPath)) {
|
||||
if (PathFileExists(cfgPath)) {
|
||||
else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy ConEmu.xml file to backup location! Restart Cmder as Administrator."
|
||||
: L"Failed to copy ConEmu.xml file to backup location!", MB_TITLE, MB_ICONSTOP);
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
||||
{
|
||||
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator."
|
||||
: L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP);
|
||||
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (PathFileExists(cfgPath)) {
|
||||
else if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy ConEmu.xml file to user-conemu.xml backup location! Restart Cmder as Administrator."
|
||||
: L"Failed to copy ConEmu.xml file to user-conemu.xml backup location!", MB_TITLE, MB_ICONSTOP);
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||
else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml.
|
||||
{
|
||||
if ( ! CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
ShowErrorAndExit(GetLastError(), __WFUNCTION__, __LINE__);
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator."
|
||||
: L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP);
|
||||
? 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);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -424,7 +432,6 @@ cmderOptions GetOption()
|
||||
{
|
||||
|
||||
// MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK);
|
||||
|
||||
if (_wcsicmp(L"/c", szArgList[i]) == 0)
|
||||
{
|
||||
TCHAR userProfile[MAX_PATH];
|
||||
|
Loading…
Reference in New Issue
Block a user