diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3bf198d17..8fb936855 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,27 @@ jobs: working-directory: scripts run: .\pack.ps1 -verbose -terminal all + - name: Upload artifact (cmder_win_mini.zip) + uses: actions/upload-artifact@v3 + with: + path: build/cmder_win_mini.zip + name: cmder_win_mini.zip + if-no-files-found: error + + - name: Upload artifact (cmder_win.7z) + uses: actions/upload-artifact@v3 + with: + path: build/cmder_win.7z + name: cmder_win.7z + if-no-files-found: error + + - name: Upload artifact (cmder_win.zip) + uses: actions/upload-artifact@v3 + with: + path: build/cmder_win.zip + name: cmder_win.zip + if-no-files-found: error + - name: Upload artifact (cmder_wt.zip) uses: actions/upload-artifact@v3 with: diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index b0e8c91ce..0cf1c4172 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -105,7 +105,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring title = L"", std::wstring iconPath = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"") +void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring title = L"", std::wstring iconPath = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"", bool admin = false) { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -131,8 +131,17 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; wchar_t conEmuDir[MAX_PATH] = { 0 }; wchar_t winDir[MAX_PATH] = { 0 }; - wchar_t emulatorPath[MAX_PATH] = { 0 }; - + wchar_t vendorDir[MAX_PATH] = { 0 }; + wchar_t initCmd[MAX_PATH] = { 0 }; + wchar_t initPowerShell[MAX_PATH] = { 0 }; + wchar_t initBash[MAX_PATH] = { 0 }; + wchar_t initMintty[MAX_PATH] = { 0 }; + wchar_t vendoredGit[MAX_PATH] = { 0 }; + wchar_t amdx64Git[MAX_PATH] = { 0 }; + wchar_t x86Git[MAX_PATH] = { 0 }; + wchar_t programFiles[MAX_PATH] = { 0 }; + wchar_t programFilesX86[MAX_PATH] = { 0 }; + wchar_t minTTYPath[MAX_PATH] = { 0 }; std::wstring cmderStart = path; std::wstring cmderTask = taskName; @@ -255,8 +264,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } - PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); - PathCombine(conEmuDir, exeDir, L"vendor\\conemu-maximus5"); + PathCombine(vendorDir, exeDir, L"vendor"); + PathCombine(windowsTerminalDir, vendorDir, L"windows-terminal"); + PathCombine(conEmuDir, vendorDir, L"conemu-maximus5"); GetEnvironmentVariable(L"WINDIR", winDir, MAX_PATH); if (PathFileExists(windowsTerminalDir)) @@ -290,60 +300,64 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr 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 ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/[cpu 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 (!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)) { - 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)) + if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { - 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); + if (PathFileExists(windowsTerminalDir)) { + 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, + (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 // 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)) + else // [terminal emulator config] file does not exist, copy config/[cpu specific terminal emulator config] file to [terminal emulator config] file { - if (PathFileExists(windowsTerminalDir)) { - 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)) + if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { - 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); + if (PathFileExists(windowsTerminalDir)) { + 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, + (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 (PathFileExists(userCfgPath)) // config/user[terminal emulator config] file exists, use it. { 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 (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_settings.json! Access Denied." @@ -360,11 +374,12 @@ 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 (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? L"Failed to copy config/user_windows_terminal_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied." @@ -382,17 +397,18 @@ 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"); } } 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 (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settings.json! Access Denied." @@ -408,11 +424,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr 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 (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied." @@ -434,16 +451,17 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { MessageBox(NULL, (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); - 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 (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 (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settings_settings.json! Access Denied." @@ -462,11 +480,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr 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)) { - if (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to [user specified path]/config/user_windows_terminal_settings.json! Access Denied." @@ -485,22 +504,50 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } + GetEnvironmentVariable(L"ProgramFiles", programFiles, MAX_PATH); + GetEnvironmentVariable(L"ProgramFiles(x86)", programFilesX86, MAX_PATH); + + PathCombine(vendoredGit, vendorDir, L"git-for-windows"); + PathCombine(amdx64Git, programFiles, L"Git"); + PathCombine(x86Git, programFilesX86, L"Git"); + SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { PathCombine(terminalPath, exeDir, L"vendor\\windows-terminal\\WindowsTerminal.exe"); } else if (PathFileExists(conEmuDir)) { + swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath); + swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str()); PathCombine(terminalPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } else { PathCombine(terminalPath, winDir, L"system32\\cmd.exe"); - } - if (!PathFileExists(windowsTerminalDir)) { - swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath); + if (streqi(cmderTask.c_str(), L"powershell")) + { + PathCombine(terminalPath, winDir, L"System32\\WindowsPowerShell\\v1.0\\powershell.exe"); + } + /* + else if (streqi(cmderTask.c_str(), L"mintty")) + { + if (PathFileExists(vendoredGit)) + { + PathCombine(terminalPath, vendoredGit, L"git-bash.exe"); + } + else if (PathFileExists(amdx64Git)) + { + PathCombine(terminalPath, amdx64Git, L"git-bash.exe"); + } + else if (PathFileExists(x86Git)) + { + PathCombine(terminalPath, x86Git, L"git-bash.exe"); + } + } + */ } if (!streqi(cmderStart.c_str(), L"")) @@ -521,13 +568,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } - if (!streqi(cmderTitle.c_str(), L"")) - { - if (!PathFileExists(windowsTerminalDir)) { - swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str()); - } - } - if (cfgRoot.length() != 0) { if (!PathFileExists(windowsTerminalDir)) { @@ -543,6 +583,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr // The `/run` arg and its value MUST be the last arg of ConEmu // see : https://conemu.github.io/en/ConEmuArgs.html // > This must be the last used switch (excepting -new_console and -cur_console) + PathCombine(initCmd, vendorDir, L"init.bat"); + PathCombine(initPowerShell, vendorDir, L"profile.ps1"); + PathCombine(initBash, vendorDir, L"start_git_bash.cmd"); + PathCombine(initMintty, vendorDir, L"start_git_mintty.cmd"); + if (!streqi(cmderTask.c_str(), L"")) { if (PathFileExists(windowsTerminalDir)) { @@ -554,7 +599,22 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } else { - swprintf_s(args, L"%s %s", args, cmderTask.c_str()); + if (streqi(cmderTask.c_str(), L"powershell")) + { + swprintf_s(args, L"%s -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%s'''\"", args, initPowerShell); + } + else if (streqi(cmderTask.c_str(), L"bash")) + { + swprintf_s(args, L"%s /c \"%s\"", args, initBash); + } + else if (streqi(cmderTask.c_str(), L"mintty")) + { + swprintf_s(args, L"%s /c \"%s\"", args, initMintty); + } + else if (streqi(cmderTask.c_str(), L"cmder")) + { + swprintf_s(args, L"%s /k \"%s\"", args, initCmd); + } } } @@ -565,6 +625,27 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr SetEnvironmentVariable(L"CMDER_USER_BIN", userBinDirPath); } + // Try to find m'intty.exe' so ConEmu can launch using %MINTTY_EXE% in external Git for Cmder Mini. + // See: https://github.com/Maximus5/ConEmu/issues/2559 for why this is commented. + + /* + if (PathFileExists(vendoredGit)) + { + PathCombine(minTTYPath, vendoredGit, L"usr\\bin\\mintty.exe"); + SetEnvironmentVariable(L"MINTTY_EXE", minTTYPath); + } + else if (PathFileExists(amdx64Git)) + { + PathCombine(minTTYPath, amdx64Git, L"usr\\bin\\mintty.exe"); + SetEnvironmentVariable(L"MINTTY_EXE", minTTYPath); + } + else if (PathFileExists(x86Git)) + { + PathCombine(minTTYPath, x86Git, L"usr\\bin\\mintty.exe"); + SetEnvironmentVariable(L"MINTTY_EXE", minTTYPath); + } + */ + // Ensure EnvironmentVariables are propagated. STARTUPINFO si = { 0 }; @@ -575,13 +656,42 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr si.dwFlags = STARTF_TITLEISAPPID; #endif PROCESS_INFORMATION pi; - + // MessageBox(NULL, terminalPath, _T("Error"), MB_OK); // MessageBox(NULL, args, _T("Error"), MB_OK); + // Let's try to rerun as Administrator + SHELLEXECUTEINFO sei = { sizeof(sei) }; + sei.fMask = SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS; + sei.lpVerb = L"runas"; + sei.lpFile = terminalPath; + sei.lpParameters = args; + sei.nShow = SW_SHOWNORMAL; + + if (admin && ShellExecuteEx(&sei)) + { + if (!sei.hProcess) + { + Sleep(500); + _ASSERTE(sei.hProcess != nullptr); + } - if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) + if (sei.hProcess) + { + WaitForSingleObject(sei.hProcess, INFINITE); + } + + // int nZone = 0; + // if (!HasZoneIdentifier(lsFile, nZone) + // || (nZone != 0 /*LocalComputer*/)) + // { + // // Assuming that elevated copy has fixed all zone problems + // break; + // } + } + else if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) { - if (PathFileExists(windowsTerminalDir)) { + if (PathFileExists(windowsTerminalDir)) + { MessageBox(NULL, _T("Unable to create the Windows Terminal process!"), _T("Error"), MB_OK); } else if (PathFileExists(conEmuDir)) @@ -709,6 +819,7 @@ struct cmderOptions std::wstring cmderIcon = L""; std::wstring cmderRegScope = L"USER"; std::wstring cmderTerminalArgs = L""; + bool cmderAdmin = false; bool cmderSingle = false; bool cmderUserCfg = true; bool registerApp = false; @@ -726,7 +837,6 @@ cmderOptions GetOption() wchar_t conEmuDir[MAX_PATH] = { 0 }; wchar_t vendorDir[MAX_PATH] = { 0 }; wchar_t exeDir[MAX_PATH] = { 0 }; - wchar_t cmdInit[MAX_PATH] = { 0 }; GetModuleFileName(NULL, exeDir, sizeof(exeDir)); PathRemoveFileSpec(exeDir); @@ -734,7 +844,6 @@ cmderOptions GetOption() PathCombine(vendorDir, exeDir, L"vendor"); PathCombine(windowsTerminalDir, vendorDir, L"windows-terminal"); PathCombine(conEmuDir, vendorDir, L"ConEmu-Maximus5"); - PathCombine(cmdInit, vendorDir, L"init.bat"); szArgList = CommandLineToArgvW(GetCommandLine(), &argCount); @@ -799,6 +908,10 @@ cmderOptions GetOption() { cmderOptions.cmderUserCfg = false; } + else if (_wcsicmp(L"/a", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && !PathFileExists(conEmuDir)) + { + cmderOptions.cmderAdmin = true; + } else if (_wcsicmp(L"/register", szArgList[i]) == 0) { cmderOptions.registerApp = true; @@ -865,14 +978,11 @@ cmderOptions GetOption() cmderOptions.error = true; } } - } - if (!PathFileExists(windowsTerminalDir) && !PathFileExists(conEmuDir)) + if (!PathFileExists(windowsTerminalDir) && !PathFileExists(conEmuDir) && streqi(cmderOptions.cmderTask.c_str(), L"")) { - cmderOptions.cmderTask = L"/k \""; - cmderOptions.cmderTask += cmdInit; - cmderOptions.cmderTask += L"\""; + cmderOptions.cmderTask = L"cmder"; } if (cmderOptions.error == true) @@ -906,13 +1016,12 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, GetModuleFileName(NULL, exeDir, sizeof(exeDir)); PathRemoveFileSpec(exeDir); - - PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); + PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); if (cmderOptions.registerApp == true) { - if (PathFileExists(windowsTerminalDir)) - { + if (PathFileExists(windowsTerminalDir)) + { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); @@ -939,8 +1048,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderTerminalArgs); - } + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderTerminalArgs, cmderOptions.cmderAdmin); } return 0; -} +} \ No newline at end of file diff --git a/launcher/src/strings.rc2 b/launcher/src/strings.rc2 index d8feb4d8b..494cbfeec 100644 --- a/launcher/src/strings.rc2 +++ b/launcher/src/strings.rc2 @@ -6,7 +6,7 @@ STRINGTABLE { IDS_TITLE "Cmder Launcher" - IDS_SWITCHES L"Valid options:\n\n /c [CMDER User Root Path]\n /task [Windows Terminal Profile/ConEmu Task Name]\n /icon [CMDER Icon Path] - ConEmu ONLY!\n [/start [Start in Path] | [Start in Path]]\n /single - ConEmu ONLY!\n /m\n -- [ConEmu/Windows Terminal extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" + IDS_SWITCHES L"Valid options:\n\n /a Admin - Native Terminals ONLY!\n /c [CMDER User Root Path]\n /task [Windows Terminal Profile/ConEmu Task Name]\n /icon [CMDER Icon Path] - ConEmu ONLY!\n [/start [Start in Path] | [Start in Path]]\n /single - ConEmu ONLY!\n /m\n -- [ConEmu/Windows Terminal extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" } /////////////////////////////////////////////////////////////////////////////