From 637b0fd3acf1554818cc5ac34bfaf006bffcffcc Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Fri, 9 Nov 2018 20:40:16 -0500 Subject: [PATCH 1/3] Ignore `%cmder_root%\config` (#1945) * move default comemu.xml to vendor folder * ignore all of config folder * cleanup --- .gitignore | 13 +-- launcher/src/CmderLauncher.cpp | 92 +++++++++++++------ .../ConEmu.xml => vendor/ConEmu.xml.default | 0 3 files changed, 71 insertions(+), 34 deletions(-) rename config/ConEmu.xml => vendor/ConEmu.xml.default (100%) diff --git a/.gitignore b/.gitignore index 3243549..ac64e10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,24 @@ ## Those files should be taken from their repositary -bin/*/* +bin/* !bin/Readme.md + vendor/*/* !vendor/bin/* !vendor/lib/* !vendor/* !vendor/psmodules/PsGet -config/.history +config/* +!config/Readme.md + Thumbs.db *.exe *.dll build/ Version v* *.bak -config/user-* -config/user_* -config/*.lua -config/settings -config/aliases -config/profile.d .github_changelog_generator launcher/.vs launcher/src/version.rc2 diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 7bd1b21..6d81411 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -110,8 +110,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(configDirPath, exeDir, L"config"); + /* + Convert legacy user-profile.cmd to new name user_profile.cmd + */ PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) { + if (PathFileExists(legacyUserProfilePath)) + { PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -124,8 +128,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + /* + Convert legacy user-aliases.cmd to new name user_aliases.cmd + */ PathCombine(legacyUserAliasesPath, configDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) { + if (PathFileExists(legacyUserAliasesPath)) + { PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -137,13 +145,18 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr userAliasesPath, (size_t)MAX_PATH); rename(lPr, pR); } - + + /* + Was -c [path] specified? + */ if (wcscmp(userConfigDirPath, L"") == 0) { + // No - It wasn't. PathCombine(userConfigDirPath, exeDir, L"config"); } else { + // Yes - It was. PathCombine(userBinDirPath, userConfigDirPath, L"bin"); SHCreateDirectoryEx(0, userBinDirPath, 0); @@ -152,9 +165,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); - + + /* + Convert legacy user-profile.cmd to new name user_profile.cmd + */ PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) { + if (PathFileExists(legacyUserProfilePath)) + { PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -167,8 +184,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + /* + Convert legacy user-aliases.cmd to new name user_aliases.cmd + */ PathCombine(legacyUserAliasesPath, userConfigDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) { + if (PathFileExists(legacyUserAliasesPath)) + { PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -186,15 +207,19 @@ 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"config\\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])); + // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) { - if (PathFileExists(cfgPath)) { + + if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. + { + if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. + { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { MessageBox(NULL, @@ -204,7 +229,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else + else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { @@ -216,8 +241,10 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(userCfgPath)) { - if (PathFileExists(cfgPath)) { + else if (PathFileExists(userCfgPath)) // If config/user_conemu.xml exists use it. + { + if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. + { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -227,7 +254,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else + else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml { if (!CopyFile(userCfgPath, cfgPath, FALSE)) { @@ -239,7 +266,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(cfgPath)) { + else if (PathFileExists(cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml + { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -249,7 +277,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else { + else // No previous conemu.xml config exists use the default. + { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { MessageBox(NULL, @@ -262,28 +291,34 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } - else { + else + { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } if (is_single_mode) { - if (!streqi(cmderTask.c_str(), L"")) { + if (!streqi(cmderTask.c_str(), L"")) + { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else { + else + { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } else { - if (!streqi(cmderTask.c_str(), L"")) { + if (!streqi(cmderTask.c_str(), L"")) + { swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else { + else + { swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } @@ -435,7 +470,8 @@ cmderOptions GetOption() cmderOptions.cmderCfgRoot = cmderCfgRoot; - if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') { + if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') + { cmderOptions.cmderCfgRoot = szArgList[i + 1]; i++; } @@ -453,7 +489,8 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i + 1]; i++; } - else { + else + { MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } @@ -505,11 +542,13 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i]; i++; } - else { + else + { MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); } } - else { + else + { MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } @@ -531,7 +570,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); - if (cmderOptions.registerApp == true) { + if (cmderOptions.registerApp == true) + { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); } diff --git a/config/ConEmu.xml b/vendor/ConEmu.xml.default similarity index 100% rename from config/ConEmu.xml rename to vendor/ConEmu.xml.default From 72b676b939053267234995622119293ff5c05092 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 10 Nov 2018 06:42:27 -0500 Subject: [PATCH 2/3] Revert "Ignore `%cmder_root%\config` (#1945)" This reverts commit 637b0fd3acf1554818cc5ac34bfaf006bffcffcc. --- .gitignore | 13 ++- .../ConEmu.xml.default => config/ConEmu.xml | 0 launcher/src/CmderLauncher.cpp | 92 ++++++------------- 3 files changed, 34 insertions(+), 71 deletions(-) rename vendor/ConEmu.xml.default => config/ConEmu.xml (100%) diff --git a/.gitignore b/.gitignore index ac64e10..3243549 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,27 @@ ## Those files should be taken from their repositary -bin/* +bin/*/* !bin/Readme.md - vendor/*/* !vendor/bin/* !vendor/lib/* !vendor/* !vendor/psmodules/PsGet -config/* -!config/Readme.md - +config/.history Thumbs.db *.exe *.dll build/ Version v* *.bak +config/user-* +config/user_* +config/*.lua +config/settings +config/aliases +config/profile.d .github_changelog_generator launcher/.vs launcher/src/version.rc2 diff --git a/vendor/ConEmu.xml.default b/config/ConEmu.xml similarity index 100% rename from vendor/ConEmu.xml.default rename to config/ConEmu.xml diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6d81411..7bd1b21 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -110,12 +110,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(configDirPath, exeDir, L"config"); - /* - Convert legacy user-profile.cmd to new name user_profile.cmd - */ PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) - { + if (PathFileExists(legacyUserProfilePath)) { PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -128,12 +124,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } - /* - Convert legacy user-aliases.cmd to new name user_aliases.cmd - */ PathCombine(legacyUserAliasesPath, configDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) - { + if (PathFileExists(legacyUserAliasesPath)) { PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -145,18 +137,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr userAliasesPath, (size_t)MAX_PATH); rename(lPr, pR); } - - /* - Was -c [path] specified? - */ + if (wcscmp(userConfigDirPath, L"") == 0) { - // No - It wasn't. PathCombine(userConfigDirPath, exeDir, L"config"); } else { - // Yes - It was. PathCombine(userBinDirPath, userConfigDirPath, L"bin"); SHCreateDirectoryEx(0, userBinDirPath, 0); @@ -165,13 +152,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); - - /* - Convert legacy user-profile.cmd to new name user_profile.cmd - */ + PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) - { + if (PathFileExists(legacyUserProfilePath)) { PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -184,12 +167,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } - /* - Convert legacy user-aliases.cmd to new name user_aliases.cmd - */ PathCombine(legacyUserAliasesPath, userConfigDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) - { + if (PathFileExists(legacyUserAliasesPath)) { PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -207,19 +186,15 @@ 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\\vendor\\ConEmu.xml.default"); + PathCombine(defaultCfgPath, exeDir, L"config\\ConEmu.xml"); // Check for machine-specific then user config source file. PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); - // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - - if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. - { - if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. - { + if (PathFileExists(cpuCfgPath)) { + if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { MessageBox(NULL, @@ -229,7 +204,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file + else { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { @@ -241,10 +216,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(userCfgPath)) // If config/user_conemu.xml exists use it. - { - if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. - { + else if (PathFileExists(userCfgPath)) { + if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -254,7 +227,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml + else { if (!CopyFile(userCfgPath, cfgPath, FALSE)) { @@ -266,8 +239,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml - { + else if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -277,8 +249,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else // No previous conemu.xml config exists use the default. - { + else { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { MessageBox(NULL, @@ -291,34 +262,28 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - { + if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } - else - { + else { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } if (is_single_mode) { - if (!streqi(cmderTask.c_str(), L"")) - { + if (!streqi(cmderTask.c_str(), L"")) { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else - { + else { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } else { - if (!streqi(cmderTask.c_str(), L"")) - { + if (!streqi(cmderTask.c_str(), L"")) { swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else - { + else { swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } @@ -470,8 +435,7 @@ cmderOptions GetOption() cmderOptions.cmderCfgRoot = cmderCfgRoot; - if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') - { + if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') { cmderOptions.cmderCfgRoot = szArgList[i + 1]; i++; } @@ -489,8 +453,7 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i + 1]; i++; } - else - { + else { MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } @@ -542,13 +505,11 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i]; i++; } - else - { + else { MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); } } - else - { + else { MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } @@ -570,8 +531,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); - if (cmderOptions.registerApp == true) - { + if (cmderOptions.registerApp == true) { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); } From bc7c6e97b3cd71ac751cd877c5e092d3368d4710 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 10 Nov 2018 09:32:44 -0500 Subject: [PATCH 3/3] Fixed move of default conemu.xml to the vendor folder --- launcher/src/CmderLauncher.cpp | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6d81411..318ef61 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -207,7 +207,7 @@ 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\\vendor\\ConEmu.xml.default"); + PathCombine(defaultCfgPath, exeDir, L"vendor\\ConEmu.xml.default"); // Check for machine-specific then user config source file. PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); @@ -216,75 +216,76 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. + if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it. { - if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. + 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 // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml 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)) { 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 config/user_conemu.xml exists use it. + else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. { - if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. + 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 // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml + 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)) // If vendor conemu.xml exists copy config/user_conemu.xml + 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 // No previous conemu.xml config exists use the default. + else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml. { - if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) + 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); } } @@ -459,7 +460,6 @@ cmderOptions GetOption() { // MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK); - if (_wcsicmp(L"/c", szArgList[i]) == 0) { TCHAR userProfile[MAX_PATH];