From 274cce1f0085c812ac46d0aac34b312d156182e9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 10 Feb 2023 19:19:50 -0800 Subject: [PATCH 01/65] optimize for speed --- vendor/init.bat | 38 ++++++++++++++++++++++++++++++-------- vendor/lib/lib_path.cmd | 38 +++++++++++++++++++++++++------------- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 027f710af..d9a7bf9b7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -306,7 +306,9 @@ goto :CONFIGURE_GIT :CONFIGURE_GIT %print_debug% init.bat "Using Git from '%GIT_INSTALL_ROOT%..." :: Add git to the path -if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" "" +if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" ( + set "path=%GIT_INSTALL_ROOT%\cmd;%path%" +) :: Add the unix commands at the end to not shadow windows commands like `more` and `find` if %nix_tools% equ 1 ( @@ -319,12 +321,24 @@ if %nix_tools% equ 1 ( if %nix_tools% geq 1 ( if exist "%GIT_INSTALL_ROOT%\mingw32" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%" + ) ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position% + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%" + ) ) if exist "%GIT_INSTALL_ROOT%\usr\bin" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" %path_position% + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%" + ) ) ) @@ -368,14 +382,23 @@ goto :PATH_ENHANCE endlocal :PATH_ENHANCE -%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" +set "path=%CMDER_ROOT%\vendor\bin;%path%" :USER_CONFIG_START -%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% +if %max_depth% gtr 1 ( + %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% +) else ( + set "path=%CMDER_ROOT%\bin;%path%" +) + if defined CMDER_USER_BIN ( + if %max_depth% gtr 1 ( %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% + ) else ( + set "path=%CMDER_USER_ROOT%\bin;%path%" + ) ) -%lib_path% enhance_path "%CMDER_ROOT%" append +set "path=%path%;%CMDER_ROOT%" :: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" :: to run them at startup. @@ -489,7 +512,6 @@ if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% -if %time_init% gtr 0 ( "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" ) exit /b diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index d9f229bc8..7cfcaa73c 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -144,8 +144,12 @@ exit /b exit /b :enhance_path_recursive + call :set_path_recursive "%~1" "%~2" "%~3" + exit /b + +:set_path_recursive :::=============================================================================== -:::enhance_path_recursive - Add a directory and subs to the path env variable if +:::set_path_recursive - Add a directory and subs to the path env variable if ::: required. :::. :::include: @@ -154,7 +158,7 @@ exit /b :::. :::usage: :::. -::: call "%~DP0lib_path" enhance_path_recursive "[dir_path]" [max_depth] [append] +::: call "%~DP0lib_path" set_path_recursive "[dir_path]" [max_depth] [append] :::. :::required: :::. @@ -196,7 +200,11 @@ exit /b if "%fast_init%" == "1" ( if "%add_to_path%" neq "" ( - call :enhance_path "%add_to_path%" %position% + if "%position%" == "append" ( + set "path=%path%;%add_to_path%" + ) else ( + set "path=%add_to_path%;%path%" + ) ) ) @@ -205,15 +213,19 @@ exit /b exit /b ) - %print_debug% :enhance_path_recursive "Env Var - add_path=%add_to_path%" - %print_debug% :enhance_path_recursive "Env Var - position=%position%" - %print_debug% :enhance_path_recursive "Env Var - depth=%depth%" - %print_debug% :enhance_path_recursive "Env Var - max_depth=%max_depth%" + %print_debug% :set_path_recursive "Env Var - add_path=%add_to_path%" + %print_debug% :set_path_recursive "Env Var - position=%position%" + %print_debug% :set_path_recursive "Env Var - depth=%depth%" + %print_debug% :set_path_recursive "Env Var - max_depth=%max_depth%" if %max_depth% gtr %depth% ( if "%add_to_path%" neq "" ( - %print_debug% :enhance_path_recursive "Adding parent directory - '%add_to_path%'" - call :enhance_path "%add_to_path%" %position% + %print_debug% :set_path_recursive "Adding parent directory - '%add_to_path%'" + if "%position%" == "append" ( + set "path=%path%;%add_to_path%" + ) else ( + set "path=%add_to_path%;%path%" + ) ) call :set_depth call :loop_depth @@ -233,10 +245,10 @@ exit /b ) for /d %%i in ("%add_path%\*") do ( - %print_debug% :enhance_path_recursive "Env Var BEFORE - depth=%depth%" - %print_debug% :enhance_path_recursive "Found Subdirectory - '%%~fi'" - call :enhance_path_recursive "%%~fi" %depth% %max_depth% %position% - %print_debug% :enhance_path_recursive "Env Var AFTER- depth=%depth%" + %print_debug% :set_path_recursive "Env Var BEFORE - depth=%depth%" + %print_debug% :set_path_recursive "Found Subdirectory - '%%~fi'" + call :set_path_recursive "%%~fi" %depth% %max_depth% %position% + %print_debug% :set_path_recursive "Env Var AFTER- depth=%depth%" ) exit /b From 56f45a81ca97e32fdd38e12dcf9d3754df0959ff Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 11 Feb 2023 18:57:27 -0800 Subject: [PATCH 02/65] add debugging of path adds --- vendor/init.bat | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index d9a7bf9b7..51f1eefd3 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -165,9 +165,22 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set CMDER_CLINK=0 ) +if exist "%CMDER_ROOT%\config\user_init.cmd" if defined CMDER_USER_CONFIG ( + call "%CMDER_ROOT%\config\user_init.cmd" + + if exist "%CMDER_USER_CONFIG%\config\user_init.cmd" ( + call "%CMDER_USER_CONFIG%\config\user_init.cmd" + ) + exit /b +) else if exist "%CMDER_ROOT%\config\user_init.cmd" ( + call "%CMDER_ROOT%\config\user_init.cmd" + exit /b +) + if "%CMDER_CLINK%" == "1" ( - REM TODO: If clink is already injected, goto :CLINK_FINISH goto :INJECT_CLINK +) else if "%CMDER_CLINK%" == "2" ( + goto :CLINK_FINISH ) goto :SKIP_CLINK @@ -204,11 +217,15 @@ goto :SKIP_CLINK ) "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor" + set CMDER_CLINK=2 if errorlevel 1 ( %print_error% "Clink initialization has failed with error code: %errorlevel%" + goto :CLINK_FINISH ) + set CMDER_CLINK=2 + goto :CLINK_FINISH :SKIP_CLINK @@ -296,19 +313,22 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" ( ) :SPECIFIED_GIT -%print_debug% init.bat "Using /GIT_INSTALL_ROOT..." +%print_debug% init.bat "Using specified GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%...." goto :CONFIGURE_GIT :FOUND_GIT -%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." +%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from 'v%GIT_INSTALL_ROOT%..." goto :CONFIGURE_GIT :CONFIGURE_GIT %print_debug% init.bat "Using Git from '%GIT_INSTALL_ROOT%..." + :: Add git to the path +%print_debug% init.bat "START - git.exe(prepend): Env Var - PATH=%path%" if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" ( set "path=%GIT_INSTALL_ROOT%\cmd;%path%" ) +%print_debug% init.bat "END - git.exe(prepend): Env Var - PATH=%path%" :: Add the unix commands at the end to not shadow windows commands like `more` and `find` if %nix_tools% equ 1 ( @@ -319,6 +339,7 @@ if %nix_tools% equ 1 ( set "path_position=" ) +%print_debug% init.bat "START - nix_tools(%path_position%): Env Var - PATH=%path%" if %nix_tools% geq 1 ( if exist "%GIT_INSTALL_ROOT%\mingw32" ( if "%path_position%" == "append" ( @@ -341,6 +362,7 @@ if %nix_tools% geq 1 ( ) ) ) +%print_debug% init.bat "END - nix_tools(%path_position%): Env Var - PATH=%path%" :SET_ENV @@ -373,8 +395,7 @@ if defined git_locale ( ) endlocal && set LANG=%LANG% -%print_debug% init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%print_debug% init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" +%print_debug% init.bat "Found Git in: 'GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%'" goto :PATH_ENHANCE :NO_GIT @@ -382,23 +403,33 @@ goto :PATH_ENHANCE endlocal :PATH_ENHANCE +%print_debug% init.bat "START - vendor/bin(prepend): Env Var - PATH=%path%" set "path=%CMDER_ROOT%\vendor\bin;%path%" +%print_debug% init.bat "END - vendor/bin(prepend): Env Var - PATH=%path%" :USER_CONFIG_START +%print_debug% init.bat "START - bin(prepend): Env Var - PATH=%path%" if %max_depth% gtr 1 ( %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% ) else ( set "path=%CMDER_ROOT%\bin;%path%" ) +%print_debug% init.bat "END - bin(prepend): Env Var - PATH=%path%" + if defined CMDER_USER_BIN ( + %print_debug% init.bat "START - user_bin(prepend): Env Var - PATH=%path%" if %max_depth% gtr 1 ( %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% ) else ( set "path=%CMDER_USER_ROOT%\bin;%path%" ) + %print_debug% init.bat "END - user_bin(prepend): Env Var - PATH=!path!" ) + +%print_debug% init.bat "START - cmder_root(append): Env Var - PATH=%path%" set "path=%path%;%CMDER_ROOT%" +%print_debug% init.bat "END - cmder_root(append): Env Var - PATH=%path%" :: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" :: to run them at startup. From 7e50f50863f57095266d59dc53253c9f093d1b69 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 11 Feb 2023 18:57:50 -0800 Subject: [PATCH 03/65] add vendor/user_init.optional.cmd --- vendor/user_init.optional.cmd | 160 ++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 vendor/user_init.optional.cmd diff --git a/vendor/user_init.optional.cmd b/vendor/user_init.optional.cmd new file mode 100644 index 000000000..b086da960 --- /dev/null +++ b/vendor/user_init.optional.cmd @@ -0,0 +1,160 @@ +@echo off + +:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +:: WARNING: THIS IS UNSUPORTED CODE USE IT IF YOU WANT. SEE BELOW FOR DETAILS! +:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +:: +:: If you use this file you will be using an unsupported option you assume all +:: and responsibility for troubleshooting any issues! +:: +:: ## What is this? +:: +:: This file initializes the Cmder `cmd.exe` shell with hard coded settings so it is much +:: faster at loading the session config since it does not have to auto discover anything. +:: +:: If you want complete control and responsibility of your Cmder setup copy this file to +:: `%CMDER_ROOT%\config\user_init.cmd` and edit to customize your setup your way. +:: +:: ## Shared Cmder Installs +:: +:: If using in a shared Cmder install copy to `%CMDER_ROOT%\config\user_init.cmd` or +:: `%CMDER_USER_ROOT%\config\user_init.cmd` whichever acieves the goal of the shared +:: install. +:: + +if "%CMDER_CLINK%" == "1" ( + goto :INJECT_CLINK +) else if "%CMDER_CLINK%" == "2" ( + goto :CLINK_FINISH +) + +goto :SKIP_CLINK + +:INJECT_CLINK + %print_verbose% "Injecting Clink!" + + :: Check if Clink is not present + if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" ( + goto :SKIP_CLINK + ) + + :: Run Clink + if not exist "%CMDER_CONFIG_DIR%\settings" if not exist "%CMDER_CONFIG_DIR%\clink_settings" ( + echo Generating Clink initial settings in "%CMDER_CONFIG_DIR%\clink_settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_CONFIG_DIR%\clink_settings" + echo Additional *.lua files in "%CMDER_CONFIG_DIR%" are loaded on startup. + ) + + if not exist "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" ( + echo Creating Cmder prompt config file: "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" + copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" + ) + + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor" + + if errorlevel 1 ( + %print_error% "Clink initialization has failed with error code: %errorlevel%" + goto :CLINK_FINISH + ) + + set CMDER_CLINK=2 + goto :CLINK_FINISH + +:SKIP_CLINK + %print_warning% "Skipping Clink Injection!" + + for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x + chcp 65001>nul + + :: Revert back to plain cmd.exe prompt without clink + prompt $E[1;32;49m$P$S$_$E[1;30;49mλ$S$E[0m + + chcp %cp%>nul +:CLINK_FINISH + +if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" +if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" +if not defined git_locale set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe" +if not defined LANG set LANG=en_US.UTF-8 +if not defined user_aliases set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd" +if not defined aliases set "aliases=%user_aliases%" +if not defined HOME set "HOME=%USERPROFILE%" + +set PLINK_PROTOCOL=ssh + +set "path=%GIT_INSTALL_ROOT%\cmd;%path%" + +set path_position=append +if %nix_tools% equ 1 ( + set "path_position=append" +) else ( + set "path_position=" +) + +if %nix_tools% geq 1 ( + if exist "%GIT_INSTALL_ROOT%\mingw32" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%" + ) + ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%" + ) + ) + if exist "%GIT_INSTALL_ROOT%\usr\bin" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%" + ) + ) +) + +set "path=%CMDER_ROOT%\vendor\bin;%path%" + +:USER_CONFIG_START +if %max_depth% gtr 1 ( + %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% +) else ( + set "path=%CMDER_ROOT%\bin;%path%" +) + +setlocal enabledelayedexpansion +if defined CMDER_USER_BIN ( + if %max_depth% gtr 1 ( + %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% + ) else ( + set "path=%CMDER_USER_ROOT%\bin;%path%" + ) +) +endlocal && set "path=%path%" + +set "path=%path%;%CMDER_ROOT%" + +call "%user_aliases%" + +%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" +if defined CMDER_USER_CONFIG ( + %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" +) + +call "%CMDER_ROOT%\config\user_profile.cmd" +if defined CMDER_USER_CONFIG ( + if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( + call "%CMDER_USER_CONFIG%\user_profile.cmd" + ) +) + +set "path=%path:;;=;% + +:CMDER_CONFIGURED +if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 + +set CMDER_INIT_END=%time% + +"%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" +exit /b From 727a99b479d57e9125e4c2c816881e9f459994b7 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 11 Feb 2023 19:27:15 -0800 Subject: [PATCH 04/65] shared or user user_init.cmd --- vendor/init.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 51f1eefd3..09ff7541e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -165,10 +165,10 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set CMDER_CLINK=0 ) -if exist "%CMDER_ROOT%\config\user_init.cmd" if defined CMDER_USER_CONFIG ( - call "%CMDER_ROOT%\config\user_init.cmd" - - if exist "%CMDER_USER_CONFIG%\config\user_init.cmd" ( +if defined CMDER_USER_CONFIG ( + if exist "%CMDER_ROOT%\config\user_init.cmd" ( + call "%CMDER_ROOT%\config\user_init.cmd" + ) else if exist "%CMDER_USER_CONFIG%\config\user_init.cmd" ( call "%CMDER_USER_CONFIG%\config\user_init.cmd" ) exit /b From 02154a8f8853e7f46e8daddf2e71cff55363a0fd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 12 Feb 2023 09:46:16 -0800 Subject: [PATCH 05/65] Update to only collext cmder env vars --- vendor/bin/cmder_diag.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/bin/cmder_diag.cmd b/vendor/bin/cmder_diag.cmd index f526cff62..d806ee6b2 100644 --- a/vendor/bin/cmder_diag.cmd +++ b/vendor/bin/cmder_diag.cmd @@ -2,9 +2,9 @@ (echo. echo ------------------------------------ -echo set +echo Get Cmder env variables... echo ------------------------------------ -set +set | findstr -i -r "^aliases= architecture_bits ccall= cexec= ^clink_ ^cmder ^debug_output= fast_init= ^GIT_INSTALL_ROOT= ^git_locale= ^HOME= ^max_depth= ^nix_tools= ^path_position= ^path= ^PLINK_PROTOCOL= ^print_ ^SVN_SSH= ^time_init= ^user_aliases= ^verbose_output=" echo. echo ------------------------------------ From 1e623ecab4a1b114c20e04906bfafbfbe9334e8b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 12 Feb 2023 09:48:27 -0800 Subject: [PATCH 06/65] auto generate cmd user_init.cmd --- vendor/bin/create-cmdercfg.ps1 | 19 ++++ vendor/init.bat | 22 ++++- vendor/psmodules/Cmder.ps1 | 25 +++++ vendor/user_init.cmd.template | 168 +++++++++++++++++++++++++++++++++ 4 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 vendor/bin/create-cmdercfg.ps1 create mode 100644 vendor/user_init.cmd.template diff --git a/vendor/bin/create-cmdercfg.ps1 b/vendor/bin/create-cmdercfg.ps1 new file mode 100644 index 000000000..5fb23a080 --- /dev/null +++ b/vendor/bin/create-cmdercfg.ps1 @@ -0,0 +1,19 @@ +[CmdletBinding()] +param( + [Parameter()] + [string]$shell = 'cmd', + [string]$outfile = "$env:cmder_root\config\user_init.cmd" +) + +$CmderModulePath = Join-path $env:cmder_root "vendor/psmodules/" +$CmderFunctions = Join-Path $CmderModulePath "Cmder.ps1" +. $CmderFunctions + +if ($shell -match 'cmd') { + write-host "Generating Cmder Config for '$shell' shell in '$outfile'..." + templateExpand "$env:cmder_root\vendor\user_init.cmd.template" "$outfile" +} elseif ($shell -match 'powershell') { + write-host "'$shell' is not supported at this time!" +} elseif ($shell -match 'bash') { + write-host "'$shell' is not supported at this time!" +} diff --git a/vendor/init.bat b/vendor/init.bat index 09ff7541e..d1ca555a6 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -417,7 +417,7 @@ if %max_depth% gtr 1 ( %print_debug% init.bat "END - bin(prepend): Env Var - PATH=%path%" -if defined CMDER_USER_BIN ( +if defined CMDER_USER_BIN if defined CMDER_USER_ROOT ( %print_debug% init.bat "START - user_bin(prepend): Env Var - PATH=%path%" if %max_depth% gtr 1 ( %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% @@ -538,6 +538,26 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD set initialConfig= +if defined CMDER_USER_CONFIG ( + if not exist "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_USER_ROOT%\config\user_init.cmd" ( + powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd" + ) + + if not exist "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_USER_ROOT%\config\user_init.cmd" ( + powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_iUSER_ROOT%\config\user_init.cmd" + ) + + if not exist "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_USER_ROOT%\config\user_init.cmd" ( + %print_error% "Failed to generate Cmder config" + ) +) else if not exist "%CMDER_ROOT%\config\user_init.cmd" ( + powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd" + + if not exist "%CMDER_ROOT%\config\user_init.cmd" ( + %print_error% "Failed to generate Cmder config" + ) +) + :CMDER_CONFIGURED if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index a42e40c95..ace3679f7 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -176,3 +176,28 @@ function getGitStatusSetting() { return $true } + +function yOrn( $question ) { + Do { + $Answer = Read-Host -Prompt "`n${question}? (y/n) " + } + Until ($Answer -eq 'y' -or $Answer -eq 'n' -or $Answer -eq 'yes' -or $Answer -eq 'no') + + return $Answer +} + +function templateExpand($template, $outfile) { + $template = Get-Content $template -Raw + $expanded = Invoke-Expression "@`"`r`n$template`r`n`"@" + + $overwrite = 'y' + if ((test-path "$outfile")) { + $overwrite = yOrn "'$outfile' already exists do you want to overwrite it" + } + + if ($overwrite -match 'y') { + $expanded | out-file -ErrorAction silentlycontinue -encoding ascii "$outfile" + } else { + write-host "Skipping Cmder '$shell' config generation at user request!" + } +} diff --git a/vendor/user_init.cmd.template b/vendor/user_init.cmd.template new file mode 100644 index 000000000..9f19502b9 --- /dev/null +++ b/vendor/user_init.cmd.template @@ -0,0 +1,168 @@ +@echo off + +:: This file was autogenerated by Cmder init.bat +:: +:: It is yours to edit and will not be touched again by Cmder. +:: +:: If you wish to recreate this file simply rename it and Cmder will re-create it the next time it is run +:: or run the followin command from a Cmder shell: +:: +:: powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd [-outfile "[filename]"] +:: + +if "%CMDER_CLINK%" == "1" ( + goto :INJECT_CLINK +) else if "%CMDER_CLINK%" == "2" ( + goto :CLINK_FINISH +) + +goto :SKIP_CLINK + +:INJECT_CLINK + %print_verbose% "Injecting Clink!" + + :: Check if Clink is not present + if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" ( + goto :SKIP_CLINK + ) + + :: Run Clink + if not exist "%CMDER_CONFIG_DIR%\settings" if not exist "%CMDER_CONFIG_DIR%\clink_settings" ( + echo Generating Clink initial settings in "%CMDER_CONFIG_DIR%\clink_settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_CONFIG_DIR%\clink_settings" + echo Additional *.lua files in "%CMDER_CONFIG_DIR%" are loaded on startup. + ) + + if not exist "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" ( + echo Creating Cmder prompt config file: "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" + copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" + ) + + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor" + + if errorlevel 1 ( + %print_error% "Clink initialization has failed with error code: %errorlevel%" + goto :CLINK_FINISH + ) + + set CMDER_CLINK=2 + goto :CLINK_FINISH + +:SKIP_CLINK + %print_warning% "Skipping Clink Injection!" + + for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x + chcp 65001>nul + + :: Revert back to plain cmd.exe prompt without clink + prompt `$E[1;32;49m`$P`$S`$_`$E[1;30;49mλ`$S`$E[0m + + chcp %cp%>nul +:CLINK_FINISH + +if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=$env:GIT_INSTALL_ROOT" +if not defined SVN_SSH set "SVN_SSH=$env:SVN_SSH" +if not defined git_locale set git_locale=$env:git_locale +if not defined LANG set LANG=$env:lang +if not defined user_aliases set "user_aliases=$env:user_aliases" +if not defined aliases set "aliases=%user_aliases%" +if not defined HOME set "HOME=%USERPROFILE%" + +set PLINK_PROTOCOL=$env:PLINK_PROTOCOL + +set "path=%GIT_INSTALL_ROOT%\cmd;%path%" + +set path_position=append +if %nix_tools% equ 1 ( + set "path_position=append" +) else ( + set "path_position=" +) + +if %nix_tools% geq 1 ( + if exist "%GIT_INSTALL_ROOT%\mingw32" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%" + ) + ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%" + ) + ) + if exist "%GIT_INSTALL_ROOT%\usr\bin" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%" + ) + ) +) + +set "path=%CMDER_ROOT%\vendor\bin;%path%" + +:USER_CONFIG_START +if %max_depth% gtr 1 ( + %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% +) else ( + set "path=%CMDER_ROOT%\bin;%path%" +) + +setlocal enabledelayedexpansion +if defined CMDER_USER_BIN ( + if %max_depth% gtr 1 ( + %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% + ) else ( + set "path=%CMDER_USER_ROOT%\bin;%path%" + ) +) +endlocal && set "path=%path%" + +set "path=%path%;%CMDER_ROOT%" + +call "%user_aliases%" + +%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" +if defined CMDER_USER_CONFIG ( + %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" +) + +call "%CMDER_ROOT%\config\user_profile.cmd" +if defined CMDER_USER_CONFIG ( + if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( + call "%CMDER_USER_CONFIG%\user_profile.cmd" + ) +) + +set "path=%path:;;=;% + +:CMDER_CONFIGURED +if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 + +set CMDER_INIT_END=%time% + +if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( + "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" +) + +:: Cleanup +set architecture_bits="" +set CMDER_ALIASES="" +set CMDER_INIT_END="" +set CMDER_INIT_START="" +set debug_output="" +set fast_init="" +set max_depth="" +set nix_tools="" +set path_position="" +set print_debug="" +set print_error="" +set print_verbose="" +set print_warning="" +set time_init="" +set verbose_output="" + +exit /b From 3a2e747d22435492c3ffed67ed6c65cf83e82f9e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 18 Feb 2023 05:40:46 -0800 Subject: [PATCH 07/65] add cleanup of unused env vars --- vendor/bin/timer.cmd | 24 +++++++++++++++++++++++ vendor/init.bat | 27 +++++++++++++++++++++----- vendor/user_init.cmd.template | 36 +++++++++++++++++++---------------- 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/vendor/bin/timer.cmd b/vendor/bin/timer.cmd index e0b84249d..68a5bc328 100644 --- a/vendor/bin/timer.cmd +++ b/vendor/bin/timer.cmd @@ -11,6 +11,7 @@ set /a hours=%end_h%-%start_h% set /a mins=%end_m%-%start_m% set /a secs=%end_s%-%start_s% set /a ms=%end_ms%-%start_ms% + if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms% if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs% if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins% @@ -20,3 +21,26 @@ if 1%ms% lss 100 set ms=0%ms% :: Mission accomplished set /a totalsecs = %hours%*3600 + %mins%*60 + %secs% echo Elapsed Time: %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total) + +:: cleanup +set start= +set end= +set options= + +set start_h= +set start_m= +set start_s= +set start_ms= + +set end_h= +set end_m= +set end_s= +set end_ms= + +set hours= +set mins= +set secs= +set ms= + +set totalsecs= + diff --git a/vendor/init.bat b/vendor/init.bat index d1ca555a6..8f459d8fe 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -559,10 +559,27 @@ if defined CMDER_USER_CONFIG ( ) :CMDER_CONFIGURED -if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 + if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 + set CMDER_INIT_END=%time% + call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" + +:: Cleanup +set architecture_bits= +set CMDER_ALIASES= +set CMDER_INIT_END= +set CMDER_INIT_START= +set CMDER_USER_FLAGS= +set debug_output= +set fast_init= +set max_depth= +set nix_tools= +set path_position= +set print_debug= +set print_error= +set print_verbose= +set print_warning= +set time_init= +set verbose_output= +set user_aliases= -set CMDER_INIT_END=%time% - - "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" -) exit /b diff --git a/vendor/user_init.cmd.template b/vendor/user_init.cmd.template index 9f19502b9..eedf299dd 100644 --- a/vendor/user_init.cmd.template +++ b/vendor/user_init.cmd.template @@ -145,24 +145,28 @@ if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( - "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" + call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" ) :: Cleanup -set architecture_bits="" -set CMDER_ALIASES="" -set CMDER_INIT_END="" -set CMDER_INIT_START="" -set debug_output="" -set fast_init="" -set max_depth="" -set nix_tools="" -set path_position="" -set print_debug="" -set print_error="" -set print_verbose="" -set print_warning="" -set time_init="" -set verbose_output="" +set architecture_bits= +set CMDER_ALIASES= +set CMDER_INIT_END= +set CMDER_INIT_START= +set CMDER_USER_FLAGS= +set debug_output= +set fast_init= +set max_depth= +set nix_tools= +set path_position= +set print_debug= +set print_error= +set print_verbose= +set print_warning= +set time_init= +set verbose_output= +set user_aliases= exit /b + + From 9cbc1845fb3b165b6e8f9486c52138da4dc53728 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 18 Feb 2023 05:56:09 -0800 Subject: [PATCH 08/65] cleanup --- vendor/init.bat | 43 ++++---- vendor/user_init.cmd.template | 196 +++++++++++++++++----------------- 2 files changed, 121 insertions(+), 118 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 8f459d8fe..97694e6b3 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -561,25 +561,28 @@ if defined CMDER_USER_CONFIG ( :CMDER_CONFIGURED if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% - call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" - -:: Cleanup -set architecture_bits= -set CMDER_ALIASES= -set CMDER_INIT_END= -set CMDER_INIT_START= -set CMDER_USER_FLAGS= -set debug_output= -set fast_init= -set max_depth= -set nix_tools= -set path_position= -set print_debug= -set print_error= -set print_verbose= -set print_warning= -set time_init= -set verbose_output= -set user_aliases= + + if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( + call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" + ) + +:CLEANUP + set architecture_bits= + set CMDER_ALIASES= + set CMDER_INIT_END= + set CMDER_INIT_START= + set CMDER_USER_FLAGS= + set debug_output= + set fast_init= + set max_depth= + set nix_tools= + set path_position= + set print_debug= + set print_error= + set print_verbose= + set print_warning= + set time_init= + set verbose_output= + set user_aliases= exit /b diff --git a/vendor/user_init.cmd.template b/vendor/user_init.cmd.template index eedf299dd..acc36f90a 100644 --- a/vendor/user_init.cmd.template +++ b/vendor/user_init.cmd.template @@ -58,114 +58,114 @@ goto :SKIP_CLINK prompt `$E[1;32;49m`$P`$S`$_`$E[1;30;49mλ`$S`$E[0m chcp %cp%>nul -:CLINK_FINISH - -if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=$env:GIT_INSTALL_ROOT" -if not defined SVN_SSH set "SVN_SSH=$env:SVN_SSH" -if not defined git_locale set git_locale=$env:git_locale -if not defined LANG set LANG=$env:lang -if not defined user_aliases set "user_aliases=$env:user_aliases" -if not defined aliases set "aliases=%user_aliases%" -if not defined HOME set "HOME=%USERPROFILE%" - -set PLINK_PROTOCOL=$env:PLINK_PROTOCOL - -set "path=%GIT_INSTALL_ROOT%\cmd;%path%" - -set path_position=append -if %nix_tools% equ 1 ( - set "path_position=append" -) else ( - set "path_position=" -) - -if %nix_tools% geq 1 ( - if exist "%GIT_INSTALL_ROOT%\mingw32" ( - if "%path_position%" == "append" ( - set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin" - ) else ( - set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%" - ) - ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( - if "%path_position%" == "append" ( - set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin" - ) else ( - set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%" - ) - ) - if exist "%GIT_INSTALL_ROOT%\usr\bin" ( - if "%path_position%" == "append" ( - set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin" - ) else ( - set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%" - ) - ) -) -set "path=%CMDER_ROOT%\vendor\bin;%path%" +:CLINK_FINISH + if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=$env:GIT_INSTALL_ROOT" + if not defined SVN_SSH set "SVN_SSH=$env:SVN_SSH" + if not defined git_locale set git_locale=$env:git_locale + if not defined LANG set LANG=$env:lang + if not defined user_aliases set "user_aliases=$env:user_aliases" + if not defined aliases set "aliases=%user_aliases%" + if not defined HOME set "HOME=%USERPROFILE%" + + set PLINK_PROTOCOL=$env:PLINK_PROTOCOL + + set "path=%GIT_INSTALL_ROOT%\cmd;%path%" + + set path_position=append + if %nix_tools% equ 1 ( + set "path_position=append" + ) else ( + set "path_position=" + ) + + if %nix_tools% geq 1 ( + if exist "%GIT_INSTALL_ROOT%\mingw32" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%" + ) + ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%" + ) + ) + if exist "%GIT_INSTALL_ROOT%\usr\bin" ( + if "%path_position%" == "append" ( + set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin" + ) else ( + set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%" + ) + ) + ) + + set "path=%CMDER_ROOT%\vendor\bin;%path%" :USER_CONFIG_START -if %max_depth% gtr 1 ( - %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% -) else ( - set "path=%CMDER_ROOT%\bin;%path%" -) - -setlocal enabledelayedexpansion -if defined CMDER_USER_BIN ( if %max_depth% gtr 1 ( - %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% + %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% ) else ( - set "path=%CMDER_USER_ROOT%\bin;%path%" + set "path=%CMDER_ROOT%\bin;%path%" ) -) -endlocal && set "path=%path%" - -set "path=%path%;%CMDER_ROOT%" - -call "%user_aliases%" - -%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" -if defined CMDER_USER_CONFIG ( - %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" -) - -call "%CMDER_ROOT%\config\user_profile.cmd" -if defined CMDER_USER_CONFIG ( - if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( - call "%CMDER_USER_CONFIG%\user_profile.cmd" + + setlocal enabledelayedexpansion + if defined CMDER_USER_BIN ( + if %max_depth% gtr 1 ( + %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% + ) else ( + set "path=%CMDER_USER_ROOT%\bin;%path%" + ) ) -) - -set "path=%path:;;=;% + endlocal && set "path=%path%" + + set "path=%path%;%CMDER_ROOT%" + + call "%user_aliases%" + + %lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" + if defined CMDER_USER_CONFIG ( + %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" + ) + + call "%CMDER_ROOT%\config\user_profile.cmd" + if defined CMDER_USER_CONFIG ( + if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( + call "%CMDER_USER_CONFIG%\user_profile.cmd" + ) + ) + + set "path=%path:;;=;% :CMDER_CONFIGURED -if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 - -set CMDER_INIT_END=%time% - -if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( - call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" -) + if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 + + set CMDER_INIT_END=%time% + + if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( + call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" + ) -:: Cleanup -set architecture_bits= -set CMDER_ALIASES= -set CMDER_INIT_END= -set CMDER_INIT_START= -set CMDER_USER_FLAGS= -set debug_output= -set fast_init= -set max_depth= -set nix_tools= -set path_position= -set print_debug= -set print_error= -set print_verbose= -set print_warning= -set time_init= -set verbose_output= -set user_aliases= +:CLEANUP + set architecture_bits= + set CMDER_ALIASES= + set CMDER_INIT_END= + set CMDER_INIT_START= + set CMDER_USER_FLAGS= + set debug_output= + set fast_init= + set max_depth= + set nix_tools= + set path_position= + set print_debug= + set print_error= + set print_verbose= + set print_warning= + set time_init= + set verbose_output= + set user_aliases= exit /b From 615ba5f81642b70161cb56f2cf055e4f0431c29e Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 18 Feb 2023 05:57:12 -0800 Subject: [PATCH 09/65] Delete user_init.optional.cmd --- vendor/user_init.optional.cmd | 160 ---------------------------------- 1 file changed, 160 deletions(-) delete mode 100644 vendor/user_init.optional.cmd diff --git a/vendor/user_init.optional.cmd b/vendor/user_init.optional.cmd deleted file mode 100644 index b086da960..000000000 --- a/vendor/user_init.optional.cmd +++ /dev/null @@ -1,160 +0,0 @@ -@echo off - -:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -:: WARNING: THIS IS UNSUPORTED CODE USE IT IF YOU WANT. SEE BELOW FOR DETAILS! -:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -:: -:: If you use this file you will be using an unsupported option you assume all -:: and responsibility for troubleshooting any issues! -:: -:: ## What is this? -:: -:: This file initializes the Cmder `cmd.exe` shell with hard coded settings so it is much -:: faster at loading the session config since it does not have to auto discover anything. -:: -:: If you want complete control and responsibility of your Cmder setup copy this file to -:: `%CMDER_ROOT%\config\user_init.cmd` and edit to customize your setup your way. -:: -:: ## Shared Cmder Installs -:: -:: If using in a shared Cmder install copy to `%CMDER_ROOT%\config\user_init.cmd` or -:: `%CMDER_USER_ROOT%\config\user_init.cmd` whichever acieves the goal of the shared -:: install. -:: - -if "%CMDER_CLINK%" == "1" ( - goto :INJECT_CLINK -) else if "%CMDER_CLINK%" == "2" ( - goto :CLINK_FINISH -) - -goto :SKIP_CLINK - -:INJECT_CLINK - %print_verbose% "Injecting Clink!" - - :: Check if Clink is not present - if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" ( - goto :SKIP_CLINK - ) - - :: Run Clink - if not exist "%CMDER_CONFIG_DIR%\settings" if not exist "%CMDER_CONFIG_DIR%\clink_settings" ( - echo Generating Clink initial settings in "%CMDER_CONFIG_DIR%\clink_settings" - copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_CONFIG_DIR%\clink_settings" - echo Additional *.lua files in "%CMDER_CONFIG_DIR%" are loaded on startup. - ) - - if not exist "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" ( - echo Creating Cmder prompt config file: "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" - copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" - ) - - "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor" - - if errorlevel 1 ( - %print_error% "Clink initialization has failed with error code: %errorlevel%" - goto :CLINK_FINISH - ) - - set CMDER_CLINK=2 - goto :CLINK_FINISH - -:SKIP_CLINK - %print_warning% "Skipping Clink Injection!" - - for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x - chcp 65001>nul - - :: Revert back to plain cmd.exe prompt without clink - prompt $E[1;32;49m$P$S$_$E[1;30;49mλ$S$E[0m - - chcp %cp%>nul -:CLINK_FINISH - -if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" -if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" -if not defined git_locale set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe" -if not defined LANG set LANG=en_US.UTF-8 -if not defined user_aliases set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd" -if not defined aliases set "aliases=%user_aliases%" -if not defined HOME set "HOME=%USERPROFILE%" - -set PLINK_PROTOCOL=ssh - -set "path=%GIT_INSTALL_ROOT%\cmd;%path%" - -set path_position=append -if %nix_tools% equ 1 ( - set "path_position=append" -) else ( - set "path_position=" -) - -if %nix_tools% geq 1 ( - if exist "%GIT_INSTALL_ROOT%\mingw32" ( - if "%path_position%" == "append" ( - set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin" - ) else ( - set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%" - ) - ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( - if "%path_position%" == "append" ( - set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin" - ) else ( - set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%" - ) - ) - if exist "%GIT_INSTALL_ROOT%\usr\bin" ( - if "%path_position%" == "append" ( - set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin" - ) else ( - set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%" - ) - ) -) - -set "path=%CMDER_ROOT%\vendor\bin;%path%" - -:USER_CONFIG_START -if %max_depth% gtr 1 ( - %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% -) else ( - set "path=%CMDER_ROOT%\bin;%path%" -) - -setlocal enabledelayedexpansion -if defined CMDER_USER_BIN ( - if %max_depth% gtr 1 ( - %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% - ) else ( - set "path=%CMDER_USER_ROOT%\bin;%path%" - ) -) -endlocal && set "path=%path%" - -set "path=%path%;%CMDER_ROOT%" - -call "%user_aliases%" - -%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" -if defined CMDER_USER_CONFIG ( - %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" -) - -call "%CMDER_ROOT%\config\user_profile.cmd" -if defined CMDER_USER_CONFIG ( - if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( - call "%CMDER_USER_CONFIG%\user_profile.cmd" - ) -) - -set "path=%path:;;=;% - -:CMDER_CONFIGURED -if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 - -set CMDER_INIT_END=%time% - -"%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" -exit /b From f1e2fb569792d0ab70727688c1c91f7e8dfc8b8c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 26 Feb 2023 18:00:26 -0800 Subject: [PATCH 10/65] prevent timer results every time. --- vendor/bin/create-cmdercfg.ps1 | 2 +- vendor/init.bat | 2 +- vendor/{user_init.cmd.template => user_init.template.cmd} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename vendor/{user_init.cmd.template => user_init.template.cmd} (98%) diff --git a/vendor/bin/create-cmdercfg.ps1 b/vendor/bin/create-cmdercfg.ps1 index 5fb23a080..16c83fa21 100644 --- a/vendor/bin/create-cmdercfg.ps1 +++ b/vendor/bin/create-cmdercfg.ps1 @@ -11,7 +11,7 @@ $CmderFunctions = Join-Path $CmderModulePath "Cmder.ps1" if ($shell -match 'cmd') { write-host "Generating Cmder Config for '$shell' shell in '$outfile'..." - templateExpand "$env:cmder_root\vendor\user_init.cmd.template" "$outfile" + templateExpand "$env:cmder_root\vendor\user_init.template.cmd" "$outfile" } elseif ($shell -match 'powershell') { write-host "'$shell' is not supported at this time!" } elseif ($shell -match 'bash') { diff --git a/vendor/init.bat b/vendor/init.bat index 97694e6b3..88df30511 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -562,7 +562,7 @@ if defined CMDER_USER_CONFIG ( if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% - if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( + if "%time_init%" == "1" if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" ) diff --git a/vendor/user_init.cmd.template b/vendor/user_init.template.cmd similarity index 98% rename from vendor/user_init.cmd.template rename to vendor/user_init.template.cmd index acc36f90a..ebfaf8570 100644 --- a/vendor/user_init.cmd.template +++ b/vendor/user_init.template.cmd @@ -144,7 +144,7 @@ goto :SKIP_CLINK set CMDER_INIT_END=%time% - if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( + if "%time_init%" == "1" if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" ( call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" ) From e0b694324ca0248bcb6b2035b26390ea242a8b91 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Mar 2023 15:00:11 -0800 Subject: [PATCH 11/65] add bypass --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 88df30511..ae4e51819 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -551,7 +551,7 @@ if defined CMDER_USER_CONFIG ( %print_error% "Failed to generate Cmder config" ) ) else if not exist "%CMDER_ROOT%\config\user_init.cmd" ( - powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd" + powershell -executionpolicy bypass -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_ROOT%\config\user_init.cmd" ( %print_error% "Failed to generate Cmder config" From c4d93655841773e6d8b34a2dbfbc607c0af09f2f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 11 Mar 2023 14:59:12 -0800 Subject: [PATCH 12/65] x --- vendor/init.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/init.bat b/vendor/init.bat index ae4e51819..97c1b0752 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -572,6 +572,7 @@ if defined CMDER_USER_CONFIG ( set CMDER_INIT_END= set CMDER_INIT_START= set CMDER_USER_FLAGS= + set CMDER_CLINK= set debug_output= set fast_init= set max_depth= From 42568b7316f2e28b5ca4c6518912b5b4edf85bfa Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 12 Mar 2023 13:02:08 -0700 Subject: [PATCH 13/65] Document '--' command line argument --- README.md | 2 +- launcher/src/strings.rc2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 735fd1e88..cda18e966 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can | `/SINGLE` | Start Cmder in single mode. | | `/START [start_path]` | Folder path to start in. | | `/TASK [task_name]` | Task to start after launch. | -| `/X [ConEmu extras pars]` | Forwards parameters to ConEmu | +| `-- [ConEmu extras pars]` | Forwards ALL remaining parameters to ConEmu. | ## Context Menu Integration diff --git a/launcher/src/strings.rc2 b/launcher/src/strings.rc2 index 088730753..67866de56 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 [ConEmu Task Name]\n /icon [CMDER Icon Path]\n [/start [Start in Path] | [Start in Path]]\n /single\n /m\n /x [ConEmu extra arguments]\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" + IDS_SWITCHES L"Valid options:\n\n /c [CMDER User Root Path]\n /task [ConEmu Task Name]\n /icon [CMDER Icon Path]\n [/start [Start in Path] | [Start in Path]]\n /single\n /m\n -- [ConEmu extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" } ///////////////////////////////////////////////////////////////////////////// From b2135cd0a93d8c62d20e95ea69748cc5969e34ef Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 30 May 2023 11:15:04 -0400 Subject: [PATCH 14/65] don't error if vim slias exists --- vendor/profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index d1087b1ad..4123bfdc2 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -87,7 +87,7 @@ if ($null -ne $ENV:GIT_INSTALL_ROOT) { } if (Get-Command -Name "vim" -ErrorAction SilentlyContinue) { - New-Alias -name "vi" -value vim + New-Alias -name "vi" -value vim -errorAction SilentlyContinue } if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { From 86b9fb25ab6329438c3307f24cd09802d1baf888 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 5 Jun 2023 13:22:28 -0400 Subject: [PATCH 15/65] Add ability to launch git bash from external Installed git whwen using Cmder - Mini --- vendor/ConEmu.xml.default | 131 +++++++++++++++++++++++--------------- vendor/cmder_exinit | 7 +- vendor/git-prompt.sh | 15 ++++- vendor/start_git_bash.cmd | 47 ++++++++++++++ 4 files changed, 142 insertions(+), 58 deletions(-) create mode 100644 vendor/start_git_bash.cmd diff --git a/vendor/ConEmu.xml.default b/vendor/ConEmu.xml.default index a4e5cc1fb..47b53d430 100644 --- a/vendor/ConEmu.xml.default +++ b/vendor/ConEmu.xml.default @@ -1,7 +1,7 @@ - + @@ -42,8 +42,8 @@ - - + + @@ -58,7 +58,7 @@ - + @@ -78,7 +78,6 @@ - @@ -113,13 +112,13 @@ - + - + - + @@ -128,8 +127,8 @@ - - + + @@ -166,19 +165,19 @@ - + - + - + - + @@ -413,15 +412,15 @@ - + - + - + @@ -484,12 +483,12 @@ - - + + - - + + @@ -497,8 +496,8 @@ - - + + @@ -507,8 +506,8 @@ - - + + @@ -516,61 +515,78 @@ - - - + + + - + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - - + - + + - - + - - + + - + - + - @@ -676,7 +692,7 @@ - + @@ -845,13 +861,13 @@ - - + + - + - + @@ -869,10 +885,16 @@ + + + + + + - + @@ -902,6 +924,15 @@ + + + + + + + + + diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 4ec3351af..6c29dfddd 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -34,7 +34,6 @@ function runProfiled { if [ ! "x${profile_d_scripts}" = "x" ] ; then for x in ${profile_d_scripts} ; do - echo Sourcing "${1}/${x}"... . "${1}/${x}" done fi @@ -46,10 +45,8 @@ function runProfiled { # We do this for bash as admin sessions since $CMDER_ROOT is not being set if [ "$CMDER_ROOT" = "" -a "$ConEmuDir" != "" ] ; then - if [ -d "${ConEmuDir}../../vendor" ] ; then + if [ -d "${ConEmuDir}/../../vendor" ] ; then case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac - else - echo "Running in ConEmu without Cmder, skipping Cmder integration." fi elif [ "$CMDER_ROOT" != "" ] ; then case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac @@ -59,8 +56,6 @@ if [ ! "$CMDER_ROOT" = "" ] ; then # Remove any trailing '/' CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') - echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"." - export CMDER_ROOT PATH=${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT} diff --git a/vendor/git-prompt.sh b/vendor/git-prompt.sh index a02af6224..189e3dc6a 100644 --- a/vendor/git-prompt.sh +++ b/vendor/git-prompt.sh @@ -38,7 +38,7 @@ then . ~/.config/git/git-prompt.sh fi else - PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title + PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]' # set window title # PS1="$PS1"'\n' # new line PS1="$PS1"'\[\033[32m\]' # change to green PS1="$PS1"'\u@\h ' # user@host @@ -71,4 +71,15 @@ else PS1="$PS1"'λ ' # prompt: always λ fi -MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc \ No newline at end of file +MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc + +# Evaluate all user-specific Bash completion scripts (if any) +if test -z "$WINELOADERNOEXEC" +then + for c in "$HOME"/bash_completion.d/*.bash + do + # Handle absence of any scripts (or the folder) gracefully + test ! -f "$c" || + . "$c" + done +fi diff --git a/vendor/start_git_bash.cmd b/vendor/start_git_bash.cmd new file mode 100644 index 000000000..136feabc4 --- /dev/null +++ b/vendor/start_git_bash.cmd @@ -0,0 +1,47 @@ +@echo off + +if not defined CMDER_ROOT ( + if defined ConEmuDir ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) else ( + for /f "delims=" %%i in ("%~dp0\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) +) + +if defined ConEmuDir ( + set "gitCommand=--command=%ConEmuBaseDirShort%\conemu-msys2-64.exe" +) + +if exist "%CMDER_ROOT%\vendor\git-for-windows" ( + set "PATH=%CMDER_ROOT%\vendor\git-for-windows\usr\bin;%PATH%" + set "gitCmd=%CMDER_ROOT%\vendor\git-for-windows\git-cmd.exe" + set "bashCmd=%CMDER_ROOT%\vendor\git-for-windows\usr\bin\bash.exe" +) else if exist "%ProgramFiles%\git" ( + set "PATH=%ProgramFiles%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles%\git\git-cmd.exe" + set "bashCmd=%ProgramFiles%\git\usr\bin\bash.exe" + if not exist "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) else if exist "%ProgramFiles(x86)%\git" ( + set "PATH=%ProgramFiles(x86)%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles(x86)%\git\git-cmd.exe" + set "bashCmd=%ProgramFiles(x86)%\git\usr\bin\bash.exe" + if not exist "%ProgramFiles(x86)%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) + +"%gitCmd%" --no-cd %gitCommand% "%bashCmd%" --login -i From 4bf659833ca8b5c32d6d1303e87fe33d106fcfaa Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Jul 2023 16:19:07 -0400 Subject: [PATCH 16/65] fix multiuser user_init.cmd creation --- vendor/bin/create-cmdercfg.ps1 | 15 ++++++++++----- vendor/init.bat | 19 ++++--------------- vendor/psmodules/Cmder.ps1 | 5 +++-- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/vendor/bin/create-cmdercfg.ps1 b/vendor/bin/create-cmdercfg.ps1 index 5fb23a080..e909a91ed 100644 --- a/vendor/bin/create-cmdercfg.ps1 +++ b/vendor/bin/create-cmdercfg.ps1 @@ -2,18 +2,23 @@ param( [Parameter()] [string]$shell = 'cmd', - [string]$outfile = "$env:cmder_root\config\user_init.cmd" + [string]$outfile = "$env:cmder_config_dir\user_init.cmd" ) +if ($shell -match 'powershell') { + write-host "'$shell' is not supported at this time!" + exit 0 +} elseif ($shell -match 'bash') { + write-host "'$shell' is not supported at this time!" + exit 0 +} + $CmderModulePath = Join-path $env:cmder_root "vendor/psmodules/" $CmderFunctions = Join-Path $CmderModulePath "Cmder.ps1" + . $CmderFunctions if ($shell -match 'cmd') { write-host "Generating Cmder Config for '$shell' shell in '$outfile'..." templateExpand "$env:cmder_root\vendor\user_init.cmd.template" "$outfile" -} elseif ($shell -match 'powershell') { - write-host "'$shell' is not supported at this time!" -} elseif ($shell -match 'bash') { - write-host "'$shell' is not supported at this time!" } diff --git a/vendor/init.bat b/vendor/init.bat index 97694e6b3..80d816938 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -168,10 +168,11 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( if defined CMDER_USER_CONFIG ( if exist "%CMDER_ROOT%\config\user_init.cmd" ( call "%CMDER_ROOT%\config\user_init.cmd" + exit /b ) else if exist "%CMDER_USER_CONFIG%\config\user_init.cmd" ( call "%CMDER_USER_CONFIG%\config\user_init.cmd" + exit /b ) - exit /b ) else if exist "%CMDER_ROOT%\config\user_init.cmd" ( call "%CMDER_ROOT%\config\user_init.cmd" exit /b @@ -538,20 +539,8 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD set initialConfig= -if defined CMDER_USER_CONFIG ( - if not exist "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_USER_ROOT%\config\user_init.cmd" ( - powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd" - ) - - if not exist "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_USER_ROOT%\config\user_init.cmd" ( - powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_iUSER_ROOT%\config\user_init.cmd" - ) - - if not exist "%CMDER_ROOT%\config\user_init.cmd" if not exist "%CMDER_USER_ROOT%\config\user_init.cmd" ( - %print_error% "Failed to generate Cmder config" - ) -) else if not exist "%CMDER_ROOT%\config\user_init.cmd" ( - powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd" +if not exist "%CMDER_CONFIG_DIR%\user_init.cmd" ( + powershell -f "%cmder_root%\vendor\bin\create-cmdercfg.ps1" -shell cmd -outfile "%CMDER_CONFIG_DIR%\user_init.cmd" if not exist "%CMDER_ROOT%\config\user_init.cmd" ( %print_error% "Failed to generate Cmder config" diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index ace3679f7..79a053fce 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -186,8 +186,9 @@ function yOrn( $question ) { return $Answer } -function templateExpand($template, $outfile) { - $template = Get-Content $template -Raw +function templateExpand($template_filename, $outfile) { + $template = Get-Content "$template_filename" -Raw + $expanded = Invoke-Expression "@`"`r`n$template`r`n`"@" $overwrite = 'y' From 294f85e33ce749d7b9f04669aa860609da4f6fc4 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Jul 2023 16:23:45 -0400 Subject: [PATCH 17/65] fixes --- vendor/bin/create-cmdercfg.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vendor/bin/create-cmdercfg.ps1 b/vendor/bin/create-cmdercfg.ps1 index e909a91ed..05aeaa467 100644 --- a/vendor/bin/create-cmdercfg.ps1 +++ b/vendor/bin/create-cmdercfg.ps1 @@ -11,6 +11,8 @@ if ($shell -match 'powershell') { } elseif ($shell -match 'bash') { write-host "'$shell' is not supported at this time!" exit 0 +} else { + exit 0 } $CmderModulePath = Join-path $env:cmder_root "vendor/psmodules/" From cd92c9fa74487636187af9cfd34bc99a84583ff0 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Jul 2023 17:51:02 -0400 Subject: [PATCH 18/65] cleanup --- vendor/init.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 2bf8839be..e391f2694 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -220,10 +220,10 @@ goto :SKIP_CLINK "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor" set CMDER_CLINK=2 - if errorlevel 1 ( - %print_error% "Clink initialization has failed with error code: %errorlevel%" - goto :CLINK_FINISH - ) + REM if errorlevel 1 ( + REM %print_error% "Clink initialization has failed with error code: %errorlevel%" + REM goto :CLINK_FINISH + REM ) set CMDER_CLINK=2 From 3ced7a2a1be06f4ddfdd9f892ca34de1cdf82234 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 4 Jul 2023 11:07:33 -0400 Subject: [PATCH 19/65] '.gitignore --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 71475ec9e..3ca812444 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,10 @@ launcher/src/version.rc2 .vs/* .vscode .idea +.vagrant/ +scripts/packer/iso/*.iso +!scripts/packer/floppy/*.exe +scripts/packer/packer_cache +scripts/packer/output-* +*.box + From 4129084494344be140c13ce8c8e784108f0e3e6b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 8 Jul 2023 13:09:10 -0700 Subject: [PATCH 20/65] add comment to clink.lua explaining /c [folderpath] --- vendor/clink.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/clink.lua b/vendor/clink.lua index 83ef0c042..b05daad75 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -666,6 +666,10 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do end end +-- If Cmder is launched with '/c [folderPath]', indicating Cmder is installed globally and +-- each user has a private '[folderPath]\config' folder, Clink won't know about the global +-- '%cmder_root%\config dir, so we need to load scripts from there before . Clink loads lua +-- scripts from the profile directory given to it when it was injected. if clink.get_env('CMDER_USER_CONFIG') then local cmder_config_dir = clink.get_env('CMDER_ROOT')..'/config/' for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do From 6b330b81f2a7e179f7e2d27870d2a40017b060fd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 11 Aug 2023 10:44:33 -0400 Subject: [PATCH 21/65] allow launching windows terminal w/cmder from cmder --- vendor/user_init.cmd.template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vendor/user_init.cmd.template b/vendor/user_init.cmd.template index ebfaf8570..82fc90b87 100644 --- a/vendor/user_init.cmd.template +++ b/vendor/user_init.cmd.template @@ -12,6 +12,8 @@ if "%CMDER_CLINK%" == "1" ( goto :INJECT_CLINK +) else if "%CMDER_CLINK%" == "2" if defined WT_PROFILE_ID ( + goto :INJECT_CLINK ) else if "%CMDER_CLINK%" == "2" ( goto :CLINK_FINISH ) From 94ea2da567941116f8c2d6f50b51c2d806c9b057 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 22 Sep 2023 17:07:56 -0400 Subject: [PATCH 22/65] make it work with windows terminal --- vendor/start_git_bash.cmd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vendor/start_git_bash.cmd b/vendor/start_git_bash.cmd index 136feabc4..679c5af9e 100644 --- a/vendor/start_git_bash.cmd +++ b/vendor/start_git_bash.cmd @@ -44,4 +44,8 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" ( ) ) -"%gitCmd%" --no-cd %gitCommand% "%bashCmd%" --login -i +if defined ConEmuDir ( + "%gitCmd%" --no-cd %gitCommand% "%bashCmd%" --login -i +) else ( + "%bashCmd%" --login -i +) From 7c04ee9f6a3f3500a9ee87e9bf09d7708bf1240d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 22 Sep 2023 17:15:23 -0400 Subject: [PATCH 23/65] fixes --- vendor/cmder_exinit | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 6c29dfddd..68022a4c9 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -26,13 +26,13 @@ function runProfiled { unset profile_d_scripts pushd "${1}" >/dev/null - if [ ! "x${ZSH_VERSION}" = "x" ]; then + if [ -n "${ZSH_VERSION}" ]; then profile_d_scripts=$(ls *.zsh 2>/dev/null) - elif [ ! "x${BASH_VERSION}" = "x" ]; then + elif [ -n "${BASH_VERSION}" ]; then profile_d_scripts=$(ls *.sh 2>/dev/null) fi - if [ ! "x${profile_d_scripts}" = "x" ] ; then + if [ -n "${profile_d_scripts}" ] ; then for x in ${profile_d_scripts} ; do . "${1}/${x}" done @@ -52,7 +52,7 @@ elif [ "$CMDER_ROOT" != "" ] ; then case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac fi -if [ ! "$CMDER_ROOT" = "" ] ; then +if [ -n "$CMDER_ROOT" ] ; then # Remove any trailing '/' CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') From 968beb8a270692f0daa6652063258a7fbf104bf4 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 11:14:54 -0400 Subject: [PATCH 24/65] Add initial Windows Terminal support --- Cmder.bat | 74 +++- launcher/src/CmderLauncher.cpp | 286 +++++++++---- scripts/build.ps1 | 35 +- vendor/windows_terminal_default_settings.json | 388 ++++++++++++++++++ 4 files changed, 677 insertions(+), 106 deletions(-) create mode 100644 vendor/windows_terminal_default_settings.json diff --git a/Cmder.bat b/Cmder.bat index d48b0eefb..987d33ff0 100644 --- a/Cmder.bat +++ b/Cmder.bat @@ -1,20 +1,66 @@ @echo off + SET CMDER_ROOT=%~dp0 -:: Remove Trailing '\' -@if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1% - -if not exist "%CMDER_ROOT%\config\user_ConEmu.xml" ( - if not exist "%CMDER_ROOT%\config" mkdir "%CMDER_ROOT%\config" 2>nul - copy "%CMDER_ROOT%\vendor\ConEmu.xml.default" "%CMDER_ROOT%\config\user_ConEmu.xml" 1>nul - if %errorlevel% neq 0 ( - echo ERROR: CMDER Initialization has Failed - exit /b 1 - ) +set CMDER_TERMINAl=conemu +if exist "%CMDER_ROOT%\vendor\windows-terminal\windowsterminal.exe" ( + SET CMDER_TERMINAL=windows-terminal ) -if exist "%~1" ( - start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1" -) else ( - start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\user_ConEmu.xml" +if NOT "%~1" == "" ( + SET CMDER_TERMINAL=%~1 + shift ) + +:: Remove Trailing '\' +if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1% + +if not exist "%CMDER_ROOT%\config" md "%CMDER_ROOT%\config" 2>nul + +call :%CMDER_TERMINAL% +exit /b + +:conemu + if not exist "%CMDER_ROOT%\config\user_ConEmu.xml" ( + copy "%CMDER_ROOT%\vendor\ConEmu.xml.default" "%CMDER_ROOT%\config\user_ConEmu.xml" 1>nul + if %errorlevel% neq 0 ( + echo ERROR: CMDER Initialization has Failed + exit /b 1 + ) + ) + + if exist "%~1" ( + start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1" + ) else ( + start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\user_ConEmu.xml" + ) + exit /b + +:windows-terminal + if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings" md "%CMDER_ROOT%\vendor\windows-terminal\settings" 2>nul + if not exist "%CMDER_ROOT%\vendor\windows-terminal\.portable" echo "This make this installation of Windows Terminal portable" >"%CMDER_ROOT%\vendor\windows-terminal\.portable" 2>nul + + if exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" ( + if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" ( + echo "Copying user Windows Terminal settings to '%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json'..." + copy "%CMDER_ROOT%\config\user_windows_terminal_settings.json" "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" 1>nul + ) + ) else if not exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" ( + if not exist "%CMDER_ROOT%\config" mkdir "%CMDER_ROOT%\config" 2>nul + echo "Copying default Windows Terminal settings to '%CMDER_ROOT%\config'..." + copy "%CMDER_ROOT%\vendor\windows_terminal_default_settings.json" "%CMDER_ROOT%\config\user_windows_terminal_settings.json" 1>nul + echo "Copying default Windows Terminal settings to '%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json'..." + copy "%CMDER_ROOT%\vendor\windows_terminal_default_settings.json" "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" 1>nul + + if %errorlevel% neq 0 ( + echo ERROR: CMDER Initialization has Failed + exit /b 1 + ) + ) else if exist "%cmder_root%\vendor\windows-terminal\settings\settings.json" ( + copy "%cmder_root%\vendor\windows-terminal\settings\settings.json" "%CMDER_ROOT%\config\user_windows_terminal_settings.json" + ) + + start %cmder_root%\vendor\windows-terminal\windowsterminal.exe + exit /b + + diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 9f033c38b..eb04b49d0 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -117,7 +117,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t cpuCfgPath[MAX_PATH] = { 0 }; wchar_t userCfgPath[MAX_PATH] = { 0 }; wchar_t defaultCfgPath[MAX_PATH] = { 0 }; - wchar_t conEmuPath[MAX_PATH] = { 0 }; + wchar_t terminalPath[MAX_PATH] = { 0 }; wchar_t configDirPath[MAX_PATH] = { 0 }; wchar_t userConfigDirPath[MAX_PATH] = { 0 }; wchar_t userBinDirPath[MAX_PATH] = { 0 }; @@ -128,12 +128,15 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 }; wchar_t args[MAX_PATH * 2 + 256] = { 0 }; wchar_t userConEmuCfgPath[MAX_PATH] = { 0 }; + wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; + wchar_t conEmuDir[MAX_PATH] = { 0 }; + wchar_t emulatorPath[MAX_PATH] = { 0 }; std::wstring cmderStart = path; std::wstring cmderTask = taskName; std::wstring cmderTitle = title; - std::wstring cmderConEmuArgs = conemu_args; + std::wstring cmderTerminalArgs = conemu_args; std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); userConfigDirPath[cfgRoot.length()] = 0; @@ -166,8 +169,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); - char *lPr = (char *)malloc(MAX_PATH); - char *pR = (char *)malloc(MAX_PATH); + char* lPr = (char*)malloc(MAX_PATH); + char* pR = (char*)malloc(MAX_PATH); size_t i; wcstombs_s(&i, lPr, (size_t)MAX_PATH, legacyUserProfilePath, (size_t)MAX_PATH); @@ -184,8 +187,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); - char *lPr = (char *)malloc(MAX_PATH); - char *pR = (char *)malloc(MAX_PATH); + char* lPr = (char*)malloc(MAX_PATH); + char* pR = (char*)malloc(MAX_PATH); size_t i; wcstombs_s(&i, lPr, (size_t)MAX_PATH, legacyUserAliasesPath, (size_t)MAX_PATH); @@ -222,8 +225,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); - char *lPr = (char *)malloc(MAX_PATH); - char *pR = (char *)malloc(MAX_PATH); + char* lPr = (char*)malloc(MAX_PATH); + char* pR = (char*)malloc(MAX_PATH); size_t i; wcstombs_s(&i, lPr, (size_t)MAX_PATH, legacyUserProfilePath, (size_t)MAX_PATH); @@ -240,8 +243,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); - char *lPr = (char *)malloc(MAX_PATH); - char *pR = (char *)malloc(MAX_PATH); + char* lPr = (char*)malloc(MAX_PATH); + char* pR = (char*)malloc(MAX_PATH); size_t i; wcstombs_s(&i, lPr, (size_t)MAX_PATH, legacyUserAliasesPath, (size_t)MAX_PATH); @@ -251,62 +254,81 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } - // Set path to vendored ConEmu config file - PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml"); + PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); + PathCombine(conEmuDir, exeDir, L"vendor\\conemu-maximus5"); - // Set path to Cmder default ConEmu config file - PathCombine(defaultCfgPath, exeDir, L"vendor\\ConEmu.xml.default"); + if (PathFileExists(windowsTerminalDir)) + { + // Set path to vendored ConEmu config file + PathCombine(cfgPath, windowsTerminalDir, L"settings\\settings.json"); - // 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 default ConEmu config file + PathCombine(defaultCfgPath, exeDir, L"vendor\\windows_terminal_default_settings.json"); - // Set path to Cmder user ConEmu config file - PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); + // Check for machine-specific then user config source file. + PathCombine(cpuCfgPath, userConfigDirPath, L"windows_terminal_%COMPUTERNAME%_settings.json"); + ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); - if ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config. + // Set path to Cmder user ConEmu config file + PathCombine(userCfgPath, userConfigDirPath, L"user_windows_terminal_settings.json"); + } + else + { + // Set path to vendored ConEmu config file + PathCombine(cfgPath, conEmuDir, L"ConEmu.xml"); + + // Set path to Cmder default ConEmu config file + 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])); + + // Set path to Cmder user ConEmu config file + PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); + } + + if (PathFileExists(cpuCfgPath) || use_user_cfg == false) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config. { if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { - 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)) { - if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) - { + if (PathFileExists(windowsTerminalDir)) { 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); + ? 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 // 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 { 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); + ? 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 // '/c [path]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu. + else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file { - if (use_user_cfg == false && PathFileExists(cfgPath) && !PathFileExists(cpuCfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml. + if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { - if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) - { + if (PathFileExists(windowsTerminalDir)) { 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); + ? 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 { + 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); } } - - PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); - ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0])); } } else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. @@ -317,27 +339,46 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? 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); + 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." + : L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_settigns.json!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + else + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? 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 // 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 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); + 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." + : L"Failed to copy config/user_windows_terminal_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + else + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? 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 // '/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_conemu.xml to start comemu. PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } } @@ -347,21 +388,41 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? 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); + 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." + : L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settigns.json!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + else + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? 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 // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml. { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { - 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!", MB_TITLE, MB_ICONSTOP); - exit(1); + 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." + : L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to vendor/windows-terminal/settings/settigns.json!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + else + { + 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!", MB_TITLE, MB_ICONSTOP); + exit(1); + } } } } @@ -380,11 +441,21 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? 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); + 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." + : L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settings_settigns.json!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + else + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? 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); + } } PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); @@ -393,51 +464,78 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE)) { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied." - : L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP); - exit(1); + 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." + : L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to [user specified path]/config/user_windows_terminal_settings.json!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + else + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied." + : L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } } PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - { - PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); + if (PathFileExists(windowsTerminalDir)) { + PathCombine(terminalPath, exeDir, L"vendor\\windows-terminal\\WindowsTerminal.exe"); } else { - PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); + PathCombine(terminalPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } - swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath); + if (!PathFileExists(windowsTerminalDir)) { + swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath); + } if (!streqi(cmderStart.c_str(), L"")) { - swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str()); + if (PathFileExists(windowsTerminalDir)) { + swprintf_s(args, L"%s -d \"%s\"", args, cmderStart.c_str()); + } + else + { + swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str()); + } } if (is_single_mode) { - swprintf_s(args, L"%s /single", args); + if (PathFileExists(windowsTerminalDir)) { + swprintf_s(args, L"%s -w 0 nt", args); + } + else + { + swprintf_s(args, L"%s /single", args); + } } if (!streqi(cmderTitle.c_str(), L"")) { - swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str()); + if (!PathFileExists(windowsTerminalDir)) { + swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str()); + } } if (cfgRoot.length() != 0) { - swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); + if (!PathFileExists(windowsTerminalDir)) { + swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); + } } - if (!streqi(cmderConEmuArgs.c_str(), L"")) + if (!streqi(cmderTerminalArgs.c_str(), L"")) { - swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str()); + swprintf_s(args, L"%s %s", args, cmderTerminalArgs.c_str()); } // The `/run` arg and its value MUST be the last arg of ConEmu @@ -445,7 +543,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr // > This must be the last used switch (excepting -new_console and -cur_console) if (!streqi(cmderTask.c_str(), L"")) { - swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str()); + if (PathFileExists(windowsTerminalDir)) { + swprintf_s(args, L"%s -p \"%s\"", args, cmderTask.c_str()); + } + else + { + swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str()); + } } SetEnvironmentVariable(L"CMDER_ROOT", exeDir); @@ -465,8 +569,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr si.dwFlags = STARTF_TITLEISAPPID; #endif PROCESS_INFORMATION pi; - if (!CreateProcess(conEmuPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) { - MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK); + if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) { + MessageBox(NULL, _T("Unable to create the terminal process!"), _T("Error"), MB_OK); return; } @@ -586,7 +690,7 @@ struct cmderOptions std::wstring cmderTitle = L"Cmder"; std::wstring cmderIcon = L""; std::wstring cmderRegScope = L"USER"; - std::wstring cmderConEmuArgs = L""; + std::wstring cmderTerminalArgs = L""; bool cmderSingle = false; bool cmderUserCfg = true; bool registerApp = false; @@ -693,7 +797,7 @@ cmderOptions GetOption() /* Used for passing arguments to conemu prog */ else if (_wcsicmp(L"/x", szArgList[i]) == 0) { - cmderOptions.cmderConEmuArgs = szArgList[i + 1]; + cmderOptions.cmderTerminalArgs = szArgList[i + 1]; i++; } /* Bare double dash, remaining commandline is for conemu */ @@ -703,7 +807,7 @@ cmderOptions GetOption() auto doubledash = cmdline.find(L" -- "); if (doubledash != std::string::npos) { - cmderOptions.cmderConEmuArgs = cmdline.substr(doubledash + 4); + cmderOptions.cmderTerminalArgs = cmdline.substr(doubledash + 4); } break; } @@ -779,7 +883,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs); + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderTerminalArgs); } return 0; diff --git a/scripts/build.ps1 b/scripts/build.ps1 index cab884948..739bc4f2d 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -55,13 +55,16 @@ Param( # Using this option will skip all downloads, if you only need to build launcher [switch]$noVendor, + + # Using this option will specify the emulator to use [conemu-maximus5, or windows-terminal] + [string]$emulator = 'conemu-maximus5', # Build launcher if you have MSBuild tools installed [switch]$Compile ) # Get the scripts and cmder root dirs we are building in. -$cmder_root = Resolve-Path "$PSScriptRoot\.." +$cmder_root = [string](Resolve-Path "$PSScriptRoot\..") # Dot source util functions into this scope . "$PSScriptRoot\utils.ps1" @@ -113,6 +116,18 @@ if (-not $noVendor) { } else { $ConEmuXml = "" } + # Preserve modified (by user) Windows Terminal setting file + if ($config -ne "") { + $WinTermSettingsJson = Join-Path $saveTo "windows-terminal\settings\settings.json" + if (Test-Path $WinTermSettingsJson -pathType leaf) { + $WinTermSettingsJsonSave = Join-Path $config "windows_terminal_settings.json" + Write-Verbose "Backup '$WinTermSettingsJson' to '$WinTermSettingsJsonSave'" + Copy-Item $WinTermSettingsJson $WinTermSettingsJsonSave + } + else { $WinTermSettingsJson = "" } + } + else { $WinTermSettingsJson = "" } + # Kill ssh-agent.exe if it is running from the $env:cmder_root we are building foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) { if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\', '\\')) { @@ -122,6 +137,12 @@ if (-not $noVendor) { } foreach ($s in $sources) { + if ($s.name -eq "conemu-maximus5" -and $emulator -eq "windows-terminal") { + return + } elseif ($s.name -eq "windows-terminal" -and $emulator -eq "conemu-maximus5") { + return + } + Write-Verbose "Getting vendored $($s.name) $($s.version)..." # We do not care about the extensions/type of archive @@ -146,6 +167,18 @@ if (-not $noVendor) { Copy-Item $ConEmuXmlSave $ConEmuXml } + # Restore Windows Terminal user configuration + if ($WinTermSettingsJson -ne "") { + Write-Verbose "Restore '$WinTermSettingsJsonSave' to '$WinTermSettingsJson'" + Copy-Item $WinTermSettingsJsonSave $WinTermSettingsJson + } + + # Make Embedded Windows Terminal Portable + if ($emulator -eq "windows-terminal") { + New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null + New-Item -Type leaf -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null + } + # Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) { Write-Verbose "Adding cmder.sh /etc/profile.d" diff --git a/vendor/windows_terminal_default_settings.json b/vendor/windows_terminal_default_settings.json new file mode 100644 index 000000000..85bf79b41 --- /dev/null +++ b/vendor/windows_terminal_default_settings.json @@ -0,0 +1,388 @@ +{ + "$help": "https://aka.ms/terminal-documentation", + "$schema": "https://aka.ms/terminal-profiles-schema", + "actions": + [ + { + "command": + { + "action": "copy", + "singleLine": false + }, + "keys": "ctrl+shift+c" + }, + { + "command": "paste" + }, + { + "command": "find", + "keys": "ctrl+shift+f" + }, + { + "command": "unbound", + "keys": "ctrl+v" + }, + { + "command": "unbound", + "keys": "ctrl+c" + }, + { + "command": + { + "action": "splitPane", + "split": "auto", + "splitMode": "duplicate" + }, + "keys": "alt+shift+d" + } + ], + "copyFormatting": "none", + "copyOnSelect": true, + "defaultProfile": "{48946353-ebe8-4571-a591-7d609f31327a}", + "newTabMenu": + [ + { + "type": "remainingProfiles" + } + ], + "profiles": + { + "defaults": {}, + "list": + [ + { + "colorScheme": "Campbell", + "commandline": "cmd /k \"%CMDER_ROOT%\\vendor\\init.bat\" /t", + "guid": "{48946353-ebe8-4571-a591-7d609f31327a}", + "hidden": false, + "icon": "%CMDER_ROOT%\\icons\\cmder.ico", + "name": "Cmder", + "startingDirectory": "", + "tabTitle": "Cmder", + "useAtlasEngine": false + }, + { + "commandline": "%SystemRoot%\\System32\\cmd.exe /k \"%CMDER_ROOT%\\vendor\\init.bat\"", + "elevate": true, + "guid": "{bdd957d0-c15a-49e6-9816-14b02351a071}", + "hidden": false, + "icon": "%CMDER_ROOT%\\icons\\cmder_red.ico", + "name": "Cmder as Admin", + "startingDirectory": "", + "tabTitle": "Cmder as Admin" + }, + { + "colorScheme": "Campbell", + "commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%CMDER_ROOT%\\vendor.\\profile.ps1'''\"", + "guid": "{eb1f6578-ce9d-47a9-a8c7-9b3fdd22302d}", + "hidden": false, + "icon": "%CMDER_ROOT%\\icons\\cmder_orange.ico", + "name": "Cmder - Powershell", + "startingDirectory": "", + "tabTitle": "Cmder", + "useAtlasEngine": false + }, + { + "colorScheme": "Campbell", + "commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%CMDER_ROOT%\\vendor.\\profile.ps1'''\"", + "elevate": true, + "guid": "{c5225c3e-8619-4145-8182-2800814eeb17}", + "hidden": false, + "icon": "%CMDER_ROOT%\\icons\\cmder_purple.ico", + "name": "Cmder - Powershell as Admin", + "startingDirectory": "", + "tabTitle": "Cmder - PowerShell as Admin", + "useAtlasEngine": false + }, + { + "commandline": "%CMDER_ROOT%\\vendor\\start_git_bash.cmd", + "guid": "{c5c298e9-010e-4b8c-bc55-e3df81846b4c}", + "hidden": false, + "icon": "%CMDER_ROOT%\\icons\\cmder_blue.ico", + "name": "Cmder - Bash", + "startingDirectory": "", + "tabTitle": "Cmder - Bash" + }, + { + "commandline": "%CMDER_ROOT%\\vendor\\start_git_bash.cmd", + "elevate": true, + "guid": "{545eb9ed-4c1c-49b3-8cc6-7eb41bd280ff}", + "hidden": false, + "icon": "%CMDER_ROOT%\\icons\\cmder_yellow.ico", + "name": "Cmder - Bash as Admin", + "startingDirectory": "", + "tabTitle": "Cmder - Bash as Admin" + }, + { + "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", + "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", + "hidden": false, + "name": "Windows PowerShell" + }, + { + "commandline": "%SystemRoot%\\System32\\cmd.exe", + "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", + "hidden": false, + "name": "Command Prompt" + } + + ] + }, + "schemes": + [ + { + "background": "#0C0C0C", + "black": "#0C0C0C", + "blue": "#0037DA", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#B4009E", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#CCCCCC", + "green": "#13A10E", + "name": "Campbell", + "purple": "#881798", + "red": "#C50F1F", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + }, + { + "background": "#012456", + "black": "#0C0C0C", + "blue": "#0037DA", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#B4009E", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#CCCCCC", + "green": "#13A10E", + "name": "Campbell Powershell", + "purple": "#881798", + "red": "#C50F1F", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + }, + { + "background": "#282C34", + "black": "#282C34", + "blue": "#61AFEF", + "brightBlack": "#5A6374", + "brightBlue": "#61AFEF", + "brightCyan": "#56B6C2", + "brightGreen": "#98C379", + "brightPurple": "#C678DD", + "brightRed": "#E06C75", + "brightWhite": "#DCDFE4", + "brightYellow": "#E5C07B", + "cursorColor": "#FFFFFF", + "cyan": "#56B6C2", + "foreground": "#DCDFE4", + "green": "#98C379", + "name": "One Half Dark", + "purple": "#C678DD", + "red": "#E06C75", + "selectionBackground": "#FFFFFF", + "white": "#DCDFE4", + "yellow": "#E5C07B" + }, + { + "background": "#FAFAFA", + "black": "#383A42", + "blue": "#0184BC", + "brightBlack": "#4F525D", + "brightBlue": "#61AFEF", + "brightCyan": "#56B5C1", + "brightGreen": "#98C379", + "brightPurple": "#C577DD", + "brightRed": "#DF6C75", + "brightWhite": "#FFFFFF", + "brightYellow": "#E4C07A", + "cursorColor": "#4F525D", + "cyan": "#0997B3", + "foreground": "#383A42", + "green": "#50A14F", + "name": "One Half Light", + "purple": "#A626A4", + "red": "#E45649", + "selectionBackground": "#FFFFFF", + "white": "#FAFAFA", + "yellow": "#C18301" + }, + { + "background": "#002B36", + "black": "#002B36", + "blue": "#268BD2", + "brightBlack": "#073642", + "brightBlue": "#839496", + "brightCyan": "#93A1A1", + "brightGreen": "#586E75", + "brightPurple": "#6C71C4", + "brightRed": "#CB4B16", + "brightWhite": "#FDF6E3", + "brightYellow": "#657B83", + "cursorColor": "#FFFFFF", + "cyan": "#2AA198", + "foreground": "#839496", + "green": "#859900", + "name": "Solarized Dark", + "purple": "#D33682", + "red": "#DC322F", + "selectionBackground": "#FFFFFF", + "white": "#EEE8D5", + "yellow": "#B58900" + }, + { + "background": "#FDF6E3", + "black": "#002B36", + "blue": "#268BD2", + "brightBlack": "#073642", + "brightBlue": "#839496", + "brightCyan": "#93A1A1", + "brightGreen": "#586E75", + "brightPurple": "#6C71C4", + "brightRed": "#CB4B16", + "brightWhite": "#FDF6E3", + "brightYellow": "#657B83", + "cursorColor": "#002B36", + "cyan": "#2AA198", + "foreground": "#657B83", + "green": "#859900", + "name": "Solarized Light", + "purple": "#D33682", + "red": "#DC322F", + "selectionBackground": "#FFFFFF", + "white": "#EEE8D5", + "yellow": "#B58900" + }, + { + "background": "#000000", + "black": "#000000", + "blue": "#3465A4", + "brightBlack": "#555753", + "brightBlue": "#729FCF", + "brightCyan": "#34E2E2", + "brightGreen": "#8AE234", + "brightPurple": "#AD7FA8", + "brightRed": "#EF2929", + "brightWhite": "#EEEEEC", + "brightYellow": "#FCE94F", + "cursorColor": "#FFFFFF", + "cyan": "#06989A", + "foreground": "#D3D7CF", + "green": "#4E9A06", + "name": "Tango Dark", + "purple": "#75507B", + "red": "#CC0000", + "selectionBackground": "#FFFFFF", + "white": "#D3D7CF", + "yellow": "#C4A000" + }, + { + "background": "#FFFFFF", + "black": "#000000", + "blue": "#3465A4", + "brightBlack": "#555753", + "brightBlue": "#729FCF", + "brightCyan": "#34E2E2", + "brightGreen": "#8AE234", + "brightPurple": "#AD7FA8", + "brightRed": "#EF2929", + "brightWhite": "#EEEEEC", + "brightYellow": "#FCE94F", + "cursorColor": "#000000", + "cyan": "#06989A", + "foreground": "#555753", + "green": "#4E9A06", + "name": "Tango Light", + "purple": "#75507B", + "red": "#CC0000", + "selectionBackground": "#FFFFFF", + "white": "#D3D7CF", + "yellow": "#C4A000" + }, + { + "background": "#000000", + "black": "#000000", + "blue": "#000080", + "brightBlack": "#808080", + "brightBlue": "#0000FF", + "brightCyan": "#00FFFF", + "brightGreen": "#00FF00", + "brightPurple": "#FF00FF", + "brightRed": "#FF0000", + "brightWhite": "#FFFFFF", + "brightYellow": "#FFFF00", + "cursorColor": "#FFFFFF", + "cyan": "#008080", + "foreground": "#C0C0C0", + "green": "#008000", + "name": "Vintage", + "purple": "#800080", + "red": "#800000", + "selectionBackground": "#FFFFFF", + "white": "#C0C0C0", + "yellow": "#808000" + } + ], + "themes": + [ + { + "name": "legacyDark", + "tab": + { + "background": null, + "showCloseButton": "always", + "unfocusedBackground": null + }, + "window": + { + "applicationTheme": "dark", + "useMica": false + } + }, + { + "name": "legacyLight", + "tab": + { + "background": null, + "showCloseButton": "always", + "unfocusedBackground": null + }, + "window": + { + "applicationTheme": "light", + "useMica": false + } + }, + { + "name": "legacySystem", + "tab": + { + "background": null, + "showCloseButton": "always", + "unfocusedBackground": null + }, + "window": + { + "applicationTheme": "system", + "useMica": false + } + } + ], + "useAcrylicInTabRow": true, + "wordDelimiters": " ()\"',;<>!@#$%^&*|+=[]{}~?\u2502" +} From 74c183c2a7fcc980948454d9e9d0c1a449fe7be5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 11:26:42 -0400 Subject: [PATCH 25/65] Add initial Windows Terminal support --- launcher/src/CmderLauncher.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index eb04b49d0..ea8ccc00f 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -510,11 +510,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr if (is_single_mode) { - if (PathFileExists(windowsTerminalDir)) { - swprintf_s(args, L"%s -w 0 nt", args); - } - else - { + if (!PathFileExists(windowsTerminalDir)) { swprintf_s(args, L"%s /single", args); } } @@ -750,21 +746,21 @@ cmderOptions GetOption() cmderOptions.cmderTask = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/title", szArgList[i]) == 0) + else if (_wcsicmp(L"/title", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) { cmderOptions.cmderTitle = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/icon", szArgList[i]) == 0) + else if (_wcsicmp(L"/icon", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) { cmderOptions.cmderIcon = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/single", szArgList[i]) == 0) + else if (_wcsicmp(L"/single", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) { { cmderOptions.cmderSingle = true; } - else if (_wcsicmp(L"/m", szArgList[i]) == 0) + else if (_wcsicmp(L"/m", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) { cmderOptions.cmderUserCfg = false; } From 2728f363024187ad03d0bb525bbc37a8e6bb31cd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 11:44:09 -0400 Subject: [PATCH 26/65] fix --- launcher/src/CmderLauncher.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index ea8ccc00f..1db17916a 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -624,11 +624,11 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgR wchar_t commandStr[MAX_PATH + 20] = { 0 }; wchar_t baseCommandStr[MAX_PATH + 20] = { 0 }; - if (!single) { - swprintf_s(baseCommandStr, L"\"%s\"", exePath); + if (single && !PathFileExists(windowsTerminalDir)) { + swprintf_s(baseCommandStr, L"\"%s\" /single", exePath); } else { - swprintf_s(baseCommandStr, L"\"%s\" /single", exePath); + swprintf_s(baseCommandStr, L"\"%s\"", exePath); } if (cfgRoot.length() == 0) // '/c [path]' was NOT specified @@ -756,7 +756,7 @@ cmderOptions GetOption() cmderOptions.cmderIcon = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/single", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) { + else if (_wcsicmp(L"/single", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) { cmderOptions.cmderSingle = true; } From 7db6297347a94a747f382b6b260840d8204c1793 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 11:57:33 -0400 Subject: [PATCH 27/65] fix --- launcher/src/CmderLauncher.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 1db17916a..95b74320d 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -624,7 +624,7 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgR wchar_t commandStr[MAX_PATH + 20] = { 0 }; wchar_t baseCommandStr[MAX_PATH + 20] = { 0 }; - if (single && !PathFileExists(windowsTerminalDir)) { + if (single) { swprintf_s(baseCommandStr, L"\"%s\" /single", exePath); } else { @@ -700,6 +700,9 @@ cmderOptions GetOption() LPWSTR *szArgList; int argCount; + wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; + PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); + szArgList = CommandLineToArgvW(GetCommandLine(), &argCount); for (int i = 1; i < argCount; i++) @@ -859,12 +862,24 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); + wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; + PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); + if (cmderOptions.registerApp == true) { - 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); - RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); + 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); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); + { + else + { + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, false); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, false); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, false); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, false); + } } else if (cmderOptions.unRegisterApp == true) { From 759d0edd812ec07b35bb1f2310cd685f59cb4317 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 12:02:57 -0400 Subject: [PATCH 28/65] fix --- launcher/src/CmderLauncher.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 95b74320d..73e006a13 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -701,6 +701,11 @@ cmderOptions GetOption() int argCount; wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; + wchar_t exeDir[MAX_PATH] = { 0 }; + + GetModuleFileName(NULL, exeDir, sizeof(exeDir)); + PathRemoveFileSpec(exeDir); + PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); szArgList = CommandLineToArgvW(GetCommandLine(), &argCount); @@ -863,7 +868,12 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; - PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); + wchar_t exeDir[MAX_PATH] = { 0 }; + + GetModuleFileName(NULL, exeDir, sizeof(exeDir)); + PathRemoveFileSpec(exeDir); + + PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); if (cmderOptions.registerApp == true) { From 63bab369cfea59f8ada0eedd225a79dda9a1f728 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 12:06:24 -0400 Subject: [PATCH 29/65] fix --- launcher/src/CmderLauncher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 73e006a13..623494570 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -882,7 +882,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, 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); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); - { + } else { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, false); From 7fa041dd7f29340dfe92a4379e1ae64a6908d1f8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 12:13:42 -0400 Subject: [PATCH 30/65] fix --- launcher/src/CmderLauncher.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 623494570..8fe3b7e66 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -877,7 +877,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, 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); From 7d3e691a69a2131c3eca563051520256ce32b8e5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 14:04:12 -0400 Subject: [PATCH 31/65] add start_git_bash.cmd --- vendor/start_git_bash.cmd | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 vendor/start_git_bash.cmd diff --git a/vendor/start_git_bash.cmd b/vendor/start_git_bash.cmd new file mode 100644 index 000000000..679c5af9e --- /dev/null +++ b/vendor/start_git_bash.cmd @@ -0,0 +1,51 @@ +@echo off + +if not defined CMDER_ROOT ( + if defined ConEmuDir ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) else ( + for /f "delims=" %%i in ("%~dp0\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) +) + +if defined ConEmuDir ( + set "gitCommand=--command=%ConEmuBaseDirShort%\conemu-msys2-64.exe" +) + +if exist "%CMDER_ROOT%\vendor\git-for-windows" ( + set "PATH=%CMDER_ROOT%\vendor\git-for-windows\usr\bin;%PATH%" + set "gitCmd=%CMDER_ROOT%\vendor\git-for-windows\git-cmd.exe" + set "bashCmd=%CMDER_ROOT%\vendor\git-for-windows\usr\bin\bash.exe" +) else if exist "%ProgramFiles%\git" ( + set "PATH=%ProgramFiles%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles%\git\git-cmd.exe" + set "bashCmd=%ProgramFiles%\git\usr\bin\bash.exe" + if not exist "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) else if exist "%ProgramFiles(x86)%\git" ( + set "PATH=%ProgramFiles(x86)%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles(x86)%\git\git-cmd.exe" + set "bashCmd=%ProgramFiles(x86)%\git\usr\bin\bash.exe" + if not exist "%ProgramFiles(x86)%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) + +if defined ConEmuDir ( + "%gitCmd%" --no-cd %gitCommand% "%bashCmd%" --login -i +) else ( + "%bashCmd%" --login -i +) From 8bb2c5d5871dfc927ffc44c5e621a832c0431db0 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 14:10:05 -0400 Subject: [PATCH 32/65] Update Cmder command line help --- launcher/src/strings.rc2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/strings.rc2 b/launcher/src/strings.rc2 index 088730753..ebf3f360f 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 [ConEmu Task Name]\n /icon [CMDER Icon Path]\n [/start [Start in Path] | [Start in Path]]\n /single\n /m\n /x [ConEmu extra arguments]\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" + 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\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]" } ///////////////////////////////////////////////////////////////////////////// From e24f653d244c74255796b627ca2e6e1ab28ce2a3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 14:26:53 -0400 Subject: [PATCH 33/65] add pack code for windows terminal releases --- scripts/pack.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 418fdcd22..3a2236d66 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -31,6 +31,9 @@ Param( # Path to the vendor configuration source file [string]$cmderRoot = "$PSScriptRoot\..", + # Using this option will pack artifacts for a specific included terminal emulator [conemu-maximus5, or windows-terminal] + [string]$emulator = 'conemu-maximus5', + # Vendor folder locaton [string]$saveTo = "$PSScriptRoot\..\build" ) @@ -41,10 +44,16 @@ $cmderRoot = Resolve-Path $cmderRoot $ErrorActionPreference = "Stop" Ensure-Executable "7z" -$targets = @{ - "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on"; - "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3"; - "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`""; +if ($emulator -eq "windows-terminal") { + $targets = @{ + "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on"; + "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3"; + "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`""; +} else { + $targets = @{ + "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on"; + "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3"; + "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`""; } Push-Location -Path $cmderRoot From ab10e83d958ce5fa8187883c17f1425d3ae8a113 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 14:47:20 -0400 Subject: [PATCH 34/65] sync and add windows terminal to sources. --- vendor/sources.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vendor/sources.json b/vendor/sources.json index c015d7860..892190687 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,4 +1,9 @@ [ + { + "name": "windows-terminal", + "version": "1.17.11461.0", + "url": "https://github.com/microsoft/terminal/releases/download/v1.17.11461.0/Microsoft.WindowsTerminal_1.17.11461.0_x64.zip" + }, { "name": "git-for-windows", "version": "2.42.0.windows.2", From ad219159191292eb6e805768cb029af1711c8fae Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 15:59:10 -0400 Subject: [PATCH 35/65] Add pack code for windows terminal --- .github/workflows/build.yml | 31 +++++++++++++++++++++++++++++-- packignore | 1 + scripts/build.ps1 | 20 ++++++++++++-------- scripts/pack.ps1 | 14 ++++++++------ 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 148ad6190..bc3075ff7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,10 +47,34 @@ jobs: working-directory: scripts run: .\build.ps1 -Compile -verbose - - name: Pack the built files + - name: Pack the built files with Windows Terminal shell: pwsh working-directory: scripts - run: .\pack.ps1 -verbose + run: .\pack.ps1 -verbose -emulator windows-terminal + + - name: Pack the built files with ConEmu + shell: pwsh + working-directory: scripts + run: .\pack.ps1 -verbose -emulator conemu + + - name: Upload artifact (cmder_wt.zip) + uses: actions/upload-artifact@v3 + with: + path: build/cmder_wt.zip + name: cmder_wt.zip + if-no-files-found: error + + - name: Upload artifact (cmder_wt.7z) + uses: actions/upload-artifact@v3 + with: + path: build/cmder_wt.7z + name: cmder_wt.7z + + - name: Upload artifact (cmder_wt_mini.zip) + uses: actions/upload-artifact@v3 + with: + path: build/cmder_wt_mini.zip + name: cmder_wt_mini.zip - name: Upload artifact (cmder.zip) uses: actions/upload-artifact@v3 @@ -82,8 +106,11 @@ jobs: with: files: | build/cmder.zip + build/cmder_wt.zip build/cmder.7z + build/cmder_wt.7z build/cmder_mini.zip + build/cmder_wt_mini.zip build/hashes.txt draft: true generate_release_notes: true diff --git a/packignore b/packignore index 1fd4315d4..7059f3cc3 100644 --- a/packignore +++ b/packignore @@ -23,5 +23,6 @@ appveyor.yml vendor\cmder.sh vendor\git-prompt.sh config\user-* +config\user_* clink_history* *.log diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 739bc4f2d..e82193eca 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -56,8 +56,8 @@ Param( # Using this option will skip all downloads, if you only need to build launcher [switch]$noVendor, - # Using this option will specify the emulator to use [conemu-maximus5, or windows-terminal] - [string]$emulator = 'conemu-maximus5', + # Using this option will specify the emulator to use [all, conemu-maximus5, or windows-terminal] + [string]$emulator = 'all', # Build launcher if you have MSBuild tools installed [switch]$Compile @@ -153,6 +153,16 @@ if (-not $noVendor) { Download-File -Url $s.url -File $vend\$tempArchive -ErrorAction Stop Extract-Archive $tempArchive $s.name + # Make Embedded Windows Terminal Portable + if ($s.name -eq "windows-terminal") { + $windowTerminalFiles = resolve-path ($saveTo + "\" + $s.name + "\terminal*") + move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null + remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null + write-verbose "Making Windows Terminal Portable..." + New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null + New-Item -Type File -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null + } + if ((Get-ChildItem $s.name).Count -eq 1) { Flatten-Directory($s.name) } @@ -173,12 +183,6 @@ if (-not $noVendor) { Copy-Item $WinTermSettingsJsonSave $WinTermSettingsJson } - # Make Embedded Windows Terminal Portable - if ($emulator -eq "windows-terminal") { - New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null - New-Item -Type leaf -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null - } - # Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) { Write-Verbose "Adding cmder.sh /etc/profile.d" diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 3a2236d66..9cd2cb768 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -46,14 +46,16 @@ Ensure-Executable "7z" if ($emulator -eq "windows-terminal") { $targets = @{ - "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on"; - "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3"; - "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`""; + "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; + "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; + "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; + } } else { $targets = @{ - "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on"; - "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3"; - "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`""; + "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`""; + "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`""; + "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`""; + } } Push-Location -Path $cmderRoot From 3671a6e13c50c946926f8d02762885676af419ec Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 16:09:47 -0400 Subject: [PATCH 36/65] pack and build all --- scripts/pack.ps1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 9cd2cb768..b41e8ca32 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -31,8 +31,8 @@ Param( # Path to the vendor configuration source file [string]$cmderRoot = "$PSScriptRoot\..", - # Using this option will pack artifacts for a specific included terminal emulator [conemu-maximus5, or windows-terminal] - [string]$emulator = 'conemu-maximus5', + # Using this option will pack artifacts for a specific included terminal emulator [all, conemu-maximus5, or windows-terminal] + [string]$emulator = 'all', # Vendor folder locaton [string]$saveTo = "$PSScriptRoot\..\build" @@ -50,8 +50,17 @@ if ($emulator -eq "windows-terminal") { "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; } +} else if ($emulator -eq "windows-terminal") { + $targets = @{ + "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`""; + "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`""; + "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`""; + } } else { $targets = @{ + "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; + "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; + "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`""; "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`""; "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`""; From 3cc22ca76425484fd42dfa675eb9a6e7757d20ce Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 16:12:52 -0400 Subject: [PATCH 37/65] pack and build all --- .github/workflows/build.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc3075ff7..1dc62b458 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,15 +47,10 @@ jobs: working-directory: scripts run: .\build.ps1 -Compile -verbose - - name: Pack the built files with Windows Terminal + - name: Pack the built files shell: pwsh working-directory: scripts - run: .\pack.ps1 -verbose -emulator windows-terminal - - - name: Pack the built files with ConEmu - shell: pwsh - working-directory: scripts - run: .\pack.ps1 -verbose -emulator conemu + run: .\pack.ps1 -verbose -emulator all - name: Upload artifact (cmder_wt.zip) uses: actions/upload-artifact@v3 From 58db4e3419bf1e5cc1bb61fcd7ce2ebbca89243a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 16:13:38 -0400 Subject: [PATCH 38/65] pack and build all --- scripts/pack.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index b41e8ca32..45e0a63d1 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -50,7 +50,7 @@ if ($emulator -eq "windows-terminal") { "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; } -} else if ($emulator -eq "windows-terminal") { +} elseif ($emulator -eq "windows-terminal") { $targets = @{ "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`""; "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`""; From 01da2fe638c0dac28909fbb1bd6bcd625c246929 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 25 Sep 2023 16:30:41 -0400 Subject: [PATCH 39/65] turn off /t in windows terminal defaults --- vendor/windows_terminal_default_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/windows_terminal_default_settings.json b/vendor/windows_terminal_default_settings.json index 85bf79b41..da60c8900 100644 --- a/vendor/windows_terminal_default_settings.json +++ b/vendor/windows_terminal_default_settings.json @@ -52,7 +52,7 @@ [ { "colorScheme": "Campbell", - "commandline": "cmd /k \"%CMDER_ROOT%\\vendor\\init.bat\" /t", + "commandline": "cmd /k \"%CMDER_ROOT%\\vendor\\init.bat\"", "guid": "{48946353-ebe8-4571-a591-7d609f31327a}", "hidden": false, "icon": "%CMDER_ROOT%\\icons\\cmder.ico", From ddad83c70f5e626d83ec2dff9658478db545c475 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 26 Sep 2023 11:17:16 -0400 Subject: [PATCH 40/65] PR Review requested changes --- launcher/src/CmderLauncher.cpp | 8 +++++++- vendor/windows_terminal_default_settings.json | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 8fe3b7e66..855cd9c6a 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -566,7 +566,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr #endif PROCESS_INFORMATION pi; if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) { - MessageBox(NULL, _T("Unable to create the terminal process!"), _T("Error"), MB_OK); + if (PathFileExists(windowsTerminalDir)) { + MessageBox(NULL, _T("Unable to create the Windows Terminal process!"), _T("Error"), MB_OK); + } + else + { + MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK); + } return; } diff --git a/vendor/windows_terminal_default_settings.json b/vendor/windows_terminal_default_settings.json index da60c8900..59ee82a48 100644 --- a/vendor/windows_terminal_default_settings.json +++ b/vendor/windows_terminal_default_settings.json @@ -77,7 +77,7 @@ "guid": "{eb1f6578-ce9d-47a9-a8c7-9b3fdd22302d}", "hidden": false, "icon": "%CMDER_ROOT%\\icons\\cmder_orange.ico", - "name": "Cmder - Powershell", + "name": "Cmder - PowerShell", "startingDirectory": "", "tabTitle": "Cmder", "useAtlasEngine": false @@ -89,7 +89,7 @@ "guid": "{c5225c3e-8619-4145-8182-2800814eeb17}", "hidden": false, "icon": "%CMDER_ROOT%\\icons\\cmder_purple.ico", - "name": "Cmder - Powershell as Admin", + "name": "Cmder - PowerShell as Admin", "startingDirectory": "", "tabTitle": "Cmder - PowerShell as Admin", "useAtlasEngine": false From 43a5e7e0b15584b9f128a56b39b3b1f21e1dba4f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 26 Sep 2023 11:24:34 -0400 Subject: [PATCH 41/65] PR Review requested changes --- Cmder.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cmder.bat b/Cmder.bat index 987d33ff0..cc2e25b25 100644 --- a/Cmder.bat +++ b/Cmder.bat @@ -38,7 +38,7 @@ exit /b :windows-terminal if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings" md "%CMDER_ROOT%\vendor\windows-terminal\settings" 2>nul - if not exist "%CMDER_ROOT%\vendor\windows-terminal\.portable" echo "This make this installation of Windows Terminal portable" >"%CMDER_ROOT%\vendor\windows-terminal\.portable" 2>nul + if not exist "%CMDER_ROOT%\vendor\windows-terminal\.portable" echo "This makes this installation of Windows Terminal portable" >"%CMDER_ROOT%\vendor\windows-terminal\.portable" 2>nul if exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" ( if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" ( From 90d86a7e5e471311675354088518820a24e6b5c3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Nov 2023 09:55:49 -0500 Subject: [PATCH 42/65] add vendor/bin/create-cmdercfg.cmd --- vendor/bin/create-cmdercfg.cmd | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 vendor/bin/create-cmdercfg.cmd diff --git a/vendor/bin/create-cmdercfg.cmd b/vendor/bin/create-cmdercfg.cmd new file mode 100644 index 000000000..cc8c7116b --- /dev/null +++ b/vendor/bin/create-cmdercfg.cmd @@ -0,0 +1,3 @@ +@echo off + +powershell -executionpolicy bypass -f "%cmder_root%\vendor\bin\create-cmdercfg.ps1" -shell cmd -outfile "%CMDER_CONFIG_DIR%\user_init.cmd" From 2ab6bcd72c4d57a6a2fd77c7a5e9de9b84ba8dc8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 10 Nov 2023 17:57:46 -0800 Subject: [PATCH 43/65] cleanup --- Cmder.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cmder.bat b/Cmder.bat index cc2e25b25..e50a44f63 100644 --- a/Cmder.bat +++ b/Cmder.bat @@ -28,7 +28,7 @@ exit /b exit /b 1 ) ) - + if exist "%~1" ( start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1" ) else ( From 86091b74e9fb16008ac6469a161bf6a433db4732 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 11 Nov 2023 17:29:28 -0800 Subject: [PATCH 44/65] properly set CMDER_ROOT for windows terminal bash --- vendor/cmder.sh | 6 +++++- vendor/cmder_exinit | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index 8467593b3..dfbf91c71 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -22,7 +22,11 @@ function runProfiled { } # We do this for bash as admin sessions since $CMDER_ROOT is not being set -if [ "$CMDER_ROOT" == "" ] ; then +if [ -z "$CMDER_ROOT" ] && [ -n "$cmder_root" ] ; then + export CMDER_ROOT=$(cygpath -u $cmder_root) +fi + +if [ -z "$CMDER_ROOT" ] ; then case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac else case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 4ec3351af..8e1b604e0 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -44,6 +44,10 @@ function runProfiled { # Check that we haven't already been sourced. [[ -z ${CMDER_EXINIT} ]] && CMDER_EXINIT="1" || return +if [ -z "$CMDER_ROOT" ] && [ -n "$cmder_root" ] ; then + export CMDER_ROOT=$(cygpath -u $cmder_root) +fi + # We do this for bash as admin sessions since $CMDER_ROOT is not being set if [ "$CMDER_ROOT" = "" -a "$ConEmuDir" != "" ] ; then if [ -d "${ConEmuDir}../../vendor" ] ; then From f0c18f1fc63647b0746dad2ee4cfd4f365e8f2cd Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 23 Nov 2023 06:50:12 -0500 Subject: [PATCH 45/65] Update Cmder.bat --- Cmder.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cmder.bat b/Cmder.bat index e50a44f63..423b2c8d6 100644 --- a/Cmder.bat +++ b/Cmder.bat @@ -2,7 +2,7 @@ SET CMDER_ROOT=%~dp0 -set CMDER_TERMINAl=conemu +set CMDER_TERMINAL=conemu if exist "%CMDER_ROOT%\vendor\windows-terminal\windowsterminal.exe" ( SET CMDER_TERMINAL=windows-terminal ) From f8aa7feb1f4c8d84922c9c98d38c35177e4e26c6 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 23 Nov 2023 07:10:59 -0500 Subject: [PATCH 46/65] PR - Requested Changes --- .github/workflows/build.yml | 4 ++-- scripts/build.ps1 | 12 ++++++------ scripts/pack.ps1 | 6 +++--- vendor/init.bat | 3 +-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dc62b458..6e803e63c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,12 +45,12 @@ jobs: - name: Build Cmder Launcher shell: pwsh working-directory: scripts - run: .\build.ps1 -Compile -verbose + run: .\build.ps1 -Compile -verbose -terminal all - name: Pack the built files shell: pwsh working-directory: scripts - run: .\pack.ps1 -verbose -emulator all + run: .\pack.ps1 -verbose -terminal all - name: Upload artifact (cmder_wt.zip) uses: actions/upload-artifact@v3 diff --git a/scripts/build.ps1 b/scripts/build.ps1 index e82193eca..b30812455 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -57,14 +57,14 @@ Param( [switch]$noVendor, # Using this option will specify the emulator to use [all, conemu-maximus5, or windows-terminal] - [string]$emulator = 'all', + [string]$terminal = 'all', # Build launcher if you have MSBuild tools installed [switch]$Compile ) # Get the scripts and cmder root dirs we are building in. -$cmder_root = [string](Resolve-Path "$PSScriptRoot\..") +$cmder_root = Resolve-Path "$PSScriptRoot\.." # Dot source util functions into this scope . "$PSScriptRoot\utils.ps1" @@ -137,9 +137,9 @@ if (-not $noVendor) { } foreach ($s in $sources) { - if ($s.name -eq "conemu-maximus5" -and $emulator -eq "windows-terminal") { + if ($s.name -eq "conemu-maximus5" -and $terminal -eq "windows-terminal") { return - } elseif ($s.name -eq "windows-terminal" -and $emulator -eq "conemu-maximus5") { + } elseif ($s.name -eq "windows-terminal" -and $terminal -eq "conemu-maximus5") { return } @@ -156,8 +156,8 @@ if (-not $noVendor) { # Make Embedded Windows Terminal Portable if ($s.name -eq "windows-terminal") { $windowTerminalFiles = resolve-path ($saveTo + "\" + $s.name + "\terminal*") - move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null - remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null + move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null + remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null write-verbose "Making Windows Terminal Portable..." New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null New-Item -Type File -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 45e0a63d1..27e3fb694 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -32,7 +32,7 @@ Param( [string]$cmderRoot = "$PSScriptRoot\..", # Using this option will pack artifacts for a specific included terminal emulator [all, conemu-maximus5, or windows-terminal] - [string]$emulator = 'all', + [string]$terminal = 'all', # Vendor folder locaton [string]$saveTo = "$PSScriptRoot\..\build" @@ -44,13 +44,13 @@ $cmderRoot = Resolve-Path $cmderRoot $ErrorActionPreference = "Stop" Ensure-Executable "7z" -if ($emulator -eq "windows-terminal") { +if ($terminal -eq "windows-terminal") { $targets = @{ "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; } -} elseif ($emulator -eq "windows-terminal") { +} elseif ($terminal -eq "windows-terminal") { $targets = @{ "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`""; "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`""; diff --git a/vendor/init.bat b/vendor/init.bat index 08c85ea2c..2de5c81ec 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -319,7 +319,7 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" ( goto :CONFIGURE_GIT :FOUND_GIT -%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from 'v%GIT_INSTALL_ROOT%..." +%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." goto :CONFIGURE_GIT :CONFIGURE_GIT @@ -418,7 +418,6 @@ if %max_depth% gtr 1 ( ) %print_debug% init.bat "END - bin(prepend): Env Var - PATH=%path%" - if defined CMDER_USER_BIN if defined CMDER_USER_ROOT ( %print_debug% init.bat "START - user_bin(prepend): Env Var - PATH=%path%" if %max_depth% gtr 1 ( From 08fd69bdef876f04494fe79adde34cd491e88e71 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 23 Nov 2023 07:16:42 -0500 Subject: [PATCH 47/65] PR - Requested Changes --- .github/workflows/build.yml | 4 ++-- scripts/build.ps1 | 12 ++++++------ scripts/pack.ps1 | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dc62b458..6e803e63c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,12 +45,12 @@ jobs: - name: Build Cmder Launcher shell: pwsh working-directory: scripts - run: .\build.ps1 -Compile -verbose + run: .\build.ps1 -Compile -verbose -terminal all - name: Pack the built files shell: pwsh working-directory: scripts - run: .\pack.ps1 -verbose -emulator all + run: .\pack.ps1 -verbose -terminal all - name: Upload artifact (cmder_wt.zip) uses: actions/upload-artifact@v3 diff --git a/scripts/build.ps1 b/scripts/build.ps1 index e82193eca..b30812455 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -57,14 +57,14 @@ Param( [switch]$noVendor, # Using this option will specify the emulator to use [all, conemu-maximus5, or windows-terminal] - [string]$emulator = 'all', + [string]$terminal = 'all', # Build launcher if you have MSBuild tools installed [switch]$Compile ) # Get the scripts and cmder root dirs we are building in. -$cmder_root = [string](Resolve-Path "$PSScriptRoot\..") +$cmder_root = Resolve-Path "$PSScriptRoot\.." # Dot source util functions into this scope . "$PSScriptRoot\utils.ps1" @@ -137,9 +137,9 @@ if (-not $noVendor) { } foreach ($s in $sources) { - if ($s.name -eq "conemu-maximus5" -and $emulator -eq "windows-terminal") { + if ($s.name -eq "conemu-maximus5" -and $terminal -eq "windows-terminal") { return - } elseif ($s.name -eq "windows-terminal" -and $emulator -eq "conemu-maximus5") { + } elseif ($s.name -eq "windows-terminal" -and $terminal -eq "conemu-maximus5") { return } @@ -156,8 +156,8 @@ if (-not $noVendor) { # Make Embedded Windows Terminal Portable if ($s.name -eq "windows-terminal") { $windowTerminalFiles = resolve-path ($saveTo + "\" + $s.name + "\terminal*") - move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null - remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null + move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null + remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null write-verbose "Making Windows Terminal Portable..." New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null New-Item -Type File -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 45e0a63d1..27e3fb694 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -32,7 +32,7 @@ Param( [string]$cmderRoot = "$PSScriptRoot\..", # Using this option will pack artifacts for a specific included terminal emulator [all, conemu-maximus5, or windows-terminal] - [string]$emulator = 'all', + [string]$terminal = 'all', # Vendor folder locaton [string]$saveTo = "$PSScriptRoot\..\build" @@ -44,13 +44,13 @@ $cmderRoot = Resolve-Path $cmderRoot $ErrorActionPreference = "Stop" Ensure-Executable "7z" -if ($emulator -eq "windows-terminal") { +if ($terminal -eq "windows-terminal") { $targets = @{ "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; } -} elseif ($emulator -eq "windows-terminal") { +} elseif ($terminal -eq "windows-terminal") { $targets = @{ "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`""; "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`""; From 26e684fb38e905f4ecd9b868d15914269b72d82c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 23 Nov 2023 07:20:26 -0500 Subject: [PATCH 48/65] PR - Requested Changes --- Cmder.bat | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cmder.bat b/Cmder.bat index e50a44f63..423b2c8d6 100644 --- a/Cmder.bat +++ b/Cmder.bat @@ -2,7 +2,7 @@ SET CMDER_ROOT=%~dp0 -set CMDER_TERMINAl=conemu +set CMDER_TERMINAL=conemu if exist "%CMDER_ROOT%\vendor\windows-terminal\windowsterminal.exe" ( SET CMDER_TERMINAL=windows-terminal ) diff --git a/README.md b/README.md index 735fd1e88..cda18e966 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can | `/SINGLE` | Start Cmder in single mode. | | `/START [start_path]` | Folder path to start in. | | `/TASK [task_name]` | Task to start after launch. | -| `/X [ConEmu extras pars]` | Forwards parameters to ConEmu | +| `-- [ConEmu extras pars]` | Forwards ALL remaining parameters to ConEmu. | ## Context Menu Integration From 67b62784c8ed952e7880f253d06d6de486ff968d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 23 Nov 2023 09:07:32 -0500 Subject: [PATCH 49/65] add cmder slim --- scripts/build.ps1 | 6 ++++-- scripts/pack.ps1 | 13 +++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index b30812455..71b955a82 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -56,7 +56,7 @@ Param( # Using this option will skip all downloads, if you only need to build launcher [switch]$noVendor, - # Using this option will specify the emulator to use [all, conemu-maximus5, or windows-terminal] + # Using this option will specify the emulator to use [none, all, conemu-maximus5, or windows-terminal] [string]$terminal = 'all', # Build launcher if you have MSBuild tools installed @@ -137,7 +137,9 @@ if (-not $noVendor) { } foreach ($s in $sources) { - if ($s.name -eq "conemu-maximus5" -and $terminal -eq "windows-terminal") { + if ($terminal -eq "none") { + return + } elseif ($s.name -eq "conemu-maximus5" -and $terminal -eq "windows-terminal") { return } elseif ($s.name -eq "windows-terminal" -and $terminal -eq "conemu-maximus5") { return diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 27e3fb694..b5de419c4 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -31,7 +31,7 @@ Param( # Path to the vendor configuration source file [string]$cmderRoot = "$PSScriptRoot\..", - # Using this option will pack artifacts for a specific included terminal emulator [all, conemu-maximus5, or windows-terminal] + # Using this option will pack artifacts for a specific included terminal emulator [none, all, conemu-maximus5, or windows-terminal] [string]$terminal = 'all', # Vendor folder locaton @@ -44,7 +44,13 @@ $cmderRoot = Resolve-Path $cmderRoot $ErrorActionPreference = "Stop" Ensure-Executable "7z" -if ($terminal -eq "windows-terminal") { +if ($terminal -eq "none") { + $targets = @{ + "cmder_slim.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_slim.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_slim_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + } +} elseif ($terminal -eq "windows-terminal") { $targets = @{ "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; @@ -58,6 +64,9 @@ if ($terminal -eq "windows-terminal") { } } else { $targets = @{ + "cmder_slim.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_slim.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_slim_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; From 99b4e66c478a9f1f28a1c3783c4039b7b18c544f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 24 Nov 2023 11:35:24 -0500 Subject: [PATCH 50/65] add Cmder for win --- launcher/src/CmderLauncher.cpp | 95 ++++++++++++++++++++++------------ scripts/pack.ps1 | 12 ++--- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index c44516a8e..0ff43d68f 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -1,4 +1,4 @@ -#include +#include / #include #include #include "resource.h" @@ -130,6 +130,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t userConEmuCfgPath[MAX_PATH] = { 0 }; wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; wchar_t conEmuDir[MAX_PATH] = { 0 }; + wchar_t winDir[MAX_PATH] = { 0 }; wchar_t emulatorPath[MAX_PATH] = { 0 }; @@ -256,6 +257,7 @@ 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"); + GetEnvironmentVariable(L"WINDIR", winDir, MAX_PATH); if (PathFileExists(windowsTerminalDir)) { @@ -272,7 +274,7 @@ 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_windows_terminal_settings.json"); } - else + else if (PathFileExists(conEmuDir)) { // Set path to vendored ConEmu config file PathCombine(cfgPath, conEmuDir, L"ConEmu.xml"); @@ -288,7 +290,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } - if (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/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config. { if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { @@ -301,7 +303,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : 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 { + 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." @@ -321,7 +324,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : 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 { + 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." @@ -331,7 +335,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. + else if (wcscmp(userCfgPath, L"") == 0 && PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. { if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { @@ -346,7 +350,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_settigns.json!", MB_TITLE, MB_ICONSTOP); exit(1); } - else + else if (PathFileExists(conEmuDir)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) @@ -367,7 +371,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy config/user_windows_terminal_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP); exit(1); } - else + else if (PathFileExists(conEmuDir)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) @@ -395,14 +399,14 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settigns.json!", MB_TITLE, MB_ICONSTOP); exit(1); } - else + else if (PathFileExists(conEmuDir)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) ? 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 // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml. { @@ -415,7 +419,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to vendor/windows-terminal/settings/settigns.json!", MB_TITLE, MB_ICONSTOP); exit(1); } - else + else if (PathFileExists(conEmuDir)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) @@ -426,18 +430,16 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else { - if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) - { - 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!", MB_TITLE, MB_ICONSTOP); + else if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) + { + 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!", MB_TITLE, MB_ICONSTOP); exit(1); - } } } - else if (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)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { @@ -460,7 +462,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } - else // '/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/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'. { if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE)) { @@ -488,10 +490,14 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr if (PathFileExists(windowsTerminalDir)) { PathCombine(terminalPath, exeDir, L"vendor\\windows-terminal\\WindowsTerminal.exe"); } - else + else if (PathFileExists(conEmuDir)) { 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); @@ -542,10 +548,14 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr if (PathFileExists(windowsTerminalDir)) { swprintf_s(args, L"%s -p \"%s\"", args, cmderTask.c_str()); } - else + else if (PathFileExists(conEmuDir)) { swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str()); } + else + { + swprintf_s(args, L"%s %s", args, cmderTask.c_str()); + } } SetEnvironmentVariable(L"CMDER_ROOT", exeDir); @@ -565,14 +575,23 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr si.dwFlags = STARTF_TITLEISAPPID; #endif PROCESS_INFORMATION pi; - if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) { + + // MessageBox(NULL, terminalPath, _T("Error"), MB_OK); + // MessageBox(NULL, args, _T("Error"), MB_OK); + + if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) + { if (PathFileExists(windowsTerminalDir)) { MessageBox(NULL, _T("Unable to create the Windows Terminal process!"), _T("Error"), MB_OK); } - else + else if (PathFileExists(conEmuDir)) { MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK); } + else + { + MessageBox(NULL, _T("Unable to create the Cmd process!"), _T("Error"), MB_OK); + } return; } } @@ -704,18 +723,23 @@ cmderOptions GetOption() int argCount; wchar_t windowsTerminalDir[MAX_PATH] = { 0 }; + 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); - PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal"); + 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); for (int i = 1; i < argCount; i++) { - // MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK); if (cmderOptions.error == false) { if (_wcsicmp(L"/c", szArgList[i]) == 0) @@ -752,26 +776,26 @@ cmderOptions GetOption() MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } - else if (_wcsicmp(L"/task", szArgList[i]) == 0) + else if (_wcsicmp(L"/task", szArgList[i]) == 0 || PathFileExists(windowsTerminalDir) || PathFileExists(conEmuDir)) { cmderOptions.cmderTask = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/title", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) + else if (_wcsicmp(L"/title", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && PathFileExists(conEmuDir)) { cmderOptions.cmderTitle = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/icon", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) + else if (_wcsicmp(L"/icon", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && PathFileExists(conEmuDir)) { cmderOptions.cmderIcon = szArgList[i + 1]; i++; } - else if (_wcsicmp(L"/single", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) + else if (_wcsicmp(L"/single", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && PathFileExists(conEmuDir)) { cmderOptions.cmderSingle = true; } - else if (_wcsicmp(L"/m", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir)) + else if (_wcsicmp(L"/m", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && PathFileExists(conEmuDir)) { cmderOptions.cmderUserCfg = false; } @@ -844,6 +868,13 @@ cmderOptions GetOption() } + if (!PathFileExists(windowsTerminalDir) && !PathFileExists(conEmuDir)) + { + cmderOptions.cmderTask = L"/k \""; + cmderOptions.cmderTask += cmdInit; + cmderOptions.cmderTask += L"\""; + } + if (cmderOptions.error == true) { wchar_t validOptions[512]; diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index b5de419c4..2b2a7042e 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -46,9 +46,9 @@ Ensure-Executable "7z" if ($terminal -eq "none") { $targets = @{ - "cmder_slim.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; - "cmder_slim.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; - "cmder_slim_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win.mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; } } elseif ($terminal -eq "windows-terminal") { $targets = @{ @@ -64,9 +64,9 @@ if ($terminal -eq "none") { } } else { $targets = @{ - "cmder_slim.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; - "cmder_slim.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; - "cmder_slim_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win.mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; From 3c2a25af9f496c5a8516465e835600432c509b76 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 24 Nov 2023 12:04:03 -0500 Subject: [PATCH 51/65] cleanup --- scripts/pack.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 2b2a7042e..a96ea049e 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -66,7 +66,7 @@ if ($terminal -eq "none") { $targets = @{ "cmder_win.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; "cmder_win.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; - "cmder_win.mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; + "cmder_win_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`""; "cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`""; "cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`""; "cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`""; From 5c101a0306be0452076c51eb5247899ce3984bda Mon Sep 17 00:00:00 2001 From: David Refoua Date: Fri, 24 Nov 2023 21:04:16 +0330 Subject: [PATCH 52/65] remove small typo --- launcher/src/CmderLauncher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 0ff43d68f..b0e8c91ce 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -1,4 +1,4 @@ -#include / +#include #include #include #include "resource.h" From 881938ed18f8d70524196ea5c6b62ee7752c6443 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 30 May 2024 16:23:51 -0400 Subject: [PATCH 53/65] Update Windows Terminal default settings and version --- vendor/sources.json | 4 +- vendor/start_git_mintty.cmd | 40 + vendor/windows_terminal_default_settings.json | 770 +++++++++--------- 3 files changed, 428 insertions(+), 386 deletions(-) create mode 100644 vendor/start_git_mintty.cmd diff --git a/vendor/sources.json b/vendor/sources.json index 9094ca5a6..4ca7b3257 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "windows-terminal", - "version": "1.17.11461.0", - "url": "https://github.com/microsoft/terminal/releases/download/v1.17.11461.0/Microsoft.WindowsTerminal_1.17.11461.0_x64.zip" + "version": "1.20.11271.0", + "url": "https://github.com/microsoft/terminal/releases/download/v1.20.11271.0/Microsoft.WindowsTerminal_1.20.11271.0_x64.zip" }, { "name": "git-for-windows", diff --git a/vendor/start_git_mintty.cmd b/vendor/start_git_mintty.cmd new file mode 100644 index 000000000..ea4f09a9f --- /dev/null +++ b/vendor/start_git_mintty.cmd @@ -0,0 +1,40 @@ +@echo off + +if not defined CMDER_ROOT ( + if defined ConEmuDir ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) else ( + for /f "delims=" %%i in ("%~dp0\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) +) + +if exist "%CMDER_ROOT%\vendor\git-for-windows" ( + set "PATH=%CMDER_ROOT%\vendor\git-for-windows\usr\bin;%PATH%" + set "gitCmd=%CMDER_ROOT%\vendor\git-for-windows\usr\bin\mintty.exe" +) else if exist "%ProgramFiles%\git" ( + set "PATH=%ProgramFiles%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles%\git\usr\bin\mintty.exe" + if not exist "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) else if exist "%ProgramFiles(x86)%\git" ( + set "PATH=%ProgramFiles(x86)%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles(x86)%\git\usr\bin\mintty.exe" + if not exist "%ProgramFiles(x86)%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) + +"%gitCmd%" /bin/bash -l diff --git a/vendor/windows_terminal_default_settings.json b/vendor/windows_terminal_default_settings.json index 59ee82a48..908d25453 100644 --- a/vendor/windows_terminal_default_settings.json +++ b/vendor/windows_terminal_default_settings.json @@ -1,388 +1,390 @@ { - "$help": "https://aka.ms/terminal-documentation", - "$schema": "https://aka.ms/terminal-profiles-schema", - "actions": - [ - { - "command": - { - "action": "copy", - "singleLine": false - }, - "keys": "ctrl+shift+c" - }, - { - "command": "paste" - }, - { - "command": "find", - "keys": "ctrl+shift+f" - }, - { - "command": "unbound", - "keys": "ctrl+v" - }, - { - "command": "unbound", - "keys": "ctrl+c" - }, - { - "command": - { - "action": "splitPane", - "split": "auto", - "splitMode": "duplicate" - }, - "keys": "alt+shift+d" - } - ], - "copyFormatting": "none", - "copyOnSelect": true, - "defaultProfile": "{48946353-ebe8-4571-a591-7d609f31327a}", - "newTabMenu": - [ - { - "type": "remainingProfiles" - } - ], - "profiles": + "$help": "https://aka.ms/terminal-documentation", + "$schema": "https://aka.ms/terminal-profiles-schema", + "actions": [ { - "defaults": {}, - "list": - [ - { - "colorScheme": "Campbell", - "commandline": "cmd /k \"%CMDER_ROOT%\\vendor\\init.bat\"", - "guid": "{48946353-ebe8-4571-a591-7d609f31327a}", - "hidden": false, - "icon": "%CMDER_ROOT%\\icons\\cmder.ico", - "name": "Cmder", - "startingDirectory": "", - "tabTitle": "Cmder", - "useAtlasEngine": false - }, - { - "commandline": "%SystemRoot%\\System32\\cmd.exe /k \"%CMDER_ROOT%\\vendor\\init.bat\"", - "elevate": true, - "guid": "{bdd957d0-c15a-49e6-9816-14b02351a071}", - "hidden": false, - "icon": "%CMDER_ROOT%\\icons\\cmder_red.ico", - "name": "Cmder as Admin", - "startingDirectory": "", - "tabTitle": "Cmder as Admin" - }, - { - "colorScheme": "Campbell", - "commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%CMDER_ROOT%\\vendor.\\profile.ps1'''\"", - "guid": "{eb1f6578-ce9d-47a9-a8c7-9b3fdd22302d}", - "hidden": false, - "icon": "%CMDER_ROOT%\\icons\\cmder_orange.ico", - "name": "Cmder - PowerShell", - "startingDirectory": "", - "tabTitle": "Cmder", - "useAtlasEngine": false - }, - { - "colorScheme": "Campbell", - "commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%CMDER_ROOT%\\vendor.\\profile.ps1'''\"", - "elevate": true, - "guid": "{c5225c3e-8619-4145-8182-2800814eeb17}", - "hidden": false, - "icon": "%CMDER_ROOT%\\icons\\cmder_purple.ico", - "name": "Cmder - PowerShell as Admin", - "startingDirectory": "", - "tabTitle": "Cmder - PowerShell as Admin", - "useAtlasEngine": false - }, - { - "commandline": "%CMDER_ROOT%\\vendor\\start_git_bash.cmd", - "guid": "{c5c298e9-010e-4b8c-bc55-e3df81846b4c}", - "hidden": false, - "icon": "%CMDER_ROOT%\\icons\\cmder_blue.ico", - "name": "Cmder - Bash", - "startingDirectory": "", - "tabTitle": "Cmder - Bash" - }, - { - "commandline": "%CMDER_ROOT%\\vendor\\start_git_bash.cmd", - "elevate": true, - "guid": "{545eb9ed-4c1c-49b3-8cc6-7eb41bd280ff}", - "hidden": false, - "icon": "%CMDER_ROOT%\\icons\\cmder_yellow.ico", - "name": "Cmder - Bash as Admin", - "startingDirectory": "", - "tabTitle": "Cmder - Bash as Admin" - }, - { - "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", - "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", - "hidden": false, - "name": "Windows PowerShell" - }, - { - "commandline": "%SystemRoot%\\System32\\cmd.exe", - "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", - "hidden": false, - "name": "Command Prompt" - } - - ] + "command": { + "action": "copy", + "singleLine": false + }, + "keys": "ctrl+shift+c" }, - "schemes": - [ - { - "background": "#0C0C0C", - "black": "#0C0C0C", - "blue": "#0037DA", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#B4009E", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#CCCCCC", - "green": "#13A10E", - "name": "Campbell", - "purple": "#881798", - "red": "#C50F1F", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - }, - { - "background": "#012456", - "black": "#0C0C0C", - "blue": "#0037DA", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#B4009E", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#CCCCCC", - "green": "#13A10E", - "name": "Campbell Powershell", - "purple": "#881798", - "red": "#C50F1F", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - }, - { - "background": "#282C34", - "black": "#282C34", - "blue": "#61AFEF", - "brightBlack": "#5A6374", - "brightBlue": "#61AFEF", - "brightCyan": "#56B6C2", - "brightGreen": "#98C379", - "brightPurple": "#C678DD", - "brightRed": "#E06C75", - "brightWhite": "#DCDFE4", - "brightYellow": "#E5C07B", - "cursorColor": "#FFFFFF", - "cyan": "#56B6C2", - "foreground": "#DCDFE4", - "green": "#98C379", - "name": "One Half Dark", - "purple": "#C678DD", - "red": "#E06C75", - "selectionBackground": "#FFFFFF", - "white": "#DCDFE4", - "yellow": "#E5C07B" - }, - { - "background": "#FAFAFA", - "black": "#383A42", - "blue": "#0184BC", - "brightBlack": "#4F525D", - "brightBlue": "#61AFEF", - "brightCyan": "#56B5C1", - "brightGreen": "#98C379", - "brightPurple": "#C577DD", - "brightRed": "#DF6C75", - "brightWhite": "#FFFFFF", - "brightYellow": "#E4C07A", - "cursorColor": "#4F525D", - "cyan": "#0997B3", - "foreground": "#383A42", - "green": "#50A14F", - "name": "One Half Light", - "purple": "#A626A4", - "red": "#E45649", - "selectionBackground": "#FFFFFF", - "white": "#FAFAFA", - "yellow": "#C18301" - }, - { - "background": "#002B36", - "black": "#002B36", - "blue": "#268BD2", - "brightBlack": "#073642", - "brightBlue": "#839496", - "brightCyan": "#93A1A1", - "brightGreen": "#586E75", - "brightPurple": "#6C71C4", - "brightRed": "#CB4B16", - "brightWhite": "#FDF6E3", - "brightYellow": "#657B83", - "cursorColor": "#FFFFFF", - "cyan": "#2AA198", - "foreground": "#839496", - "green": "#859900", - "name": "Solarized Dark", - "purple": "#D33682", - "red": "#DC322F", - "selectionBackground": "#FFFFFF", - "white": "#EEE8D5", - "yellow": "#B58900" - }, - { - "background": "#FDF6E3", - "black": "#002B36", - "blue": "#268BD2", - "brightBlack": "#073642", - "brightBlue": "#839496", - "brightCyan": "#93A1A1", - "brightGreen": "#586E75", - "brightPurple": "#6C71C4", - "brightRed": "#CB4B16", - "brightWhite": "#FDF6E3", - "brightYellow": "#657B83", - "cursorColor": "#002B36", - "cyan": "#2AA198", - "foreground": "#657B83", - "green": "#859900", - "name": "Solarized Light", - "purple": "#D33682", - "red": "#DC322F", - "selectionBackground": "#FFFFFF", - "white": "#EEE8D5", - "yellow": "#B58900" - }, - { - "background": "#000000", - "black": "#000000", - "blue": "#3465A4", - "brightBlack": "#555753", - "brightBlue": "#729FCF", - "brightCyan": "#34E2E2", - "brightGreen": "#8AE234", - "brightPurple": "#AD7FA8", - "brightRed": "#EF2929", - "brightWhite": "#EEEEEC", - "brightYellow": "#FCE94F", - "cursorColor": "#FFFFFF", - "cyan": "#06989A", - "foreground": "#D3D7CF", - "green": "#4E9A06", - "name": "Tango Dark", - "purple": "#75507B", - "red": "#CC0000", - "selectionBackground": "#FFFFFF", - "white": "#D3D7CF", - "yellow": "#C4A000" - }, - { - "background": "#FFFFFF", - "black": "#000000", - "blue": "#3465A4", - "brightBlack": "#555753", - "brightBlue": "#729FCF", - "brightCyan": "#34E2E2", - "brightGreen": "#8AE234", - "brightPurple": "#AD7FA8", - "brightRed": "#EF2929", - "brightWhite": "#EEEEEC", - "brightYellow": "#FCE94F", - "cursorColor": "#000000", - "cyan": "#06989A", - "foreground": "#555753", - "green": "#4E9A06", - "name": "Tango Light", - "purple": "#75507B", - "red": "#CC0000", - "selectionBackground": "#FFFFFF", - "white": "#D3D7CF", - "yellow": "#C4A000" - }, - { - "background": "#000000", - "black": "#000000", - "blue": "#000080", - "brightBlack": "#808080", - "brightBlue": "#0000FF", - "brightCyan": "#00FFFF", - "brightGreen": "#00FF00", - "brightPurple": "#FF00FF", - "brightRed": "#FF0000", - "brightWhite": "#FFFFFF", - "brightYellow": "#FFFF00", - "cursorColor": "#FFFFFF", - "cyan": "#008080", - "foreground": "#C0C0C0", - "green": "#008000", - "name": "Vintage", - "purple": "#800080", - "red": "#800000", - "selectionBackground": "#FFFFFF", - "white": "#C0C0C0", - "yellow": "#808000" - } - ], - "themes": - [ - { - "name": "legacyDark", - "tab": - { - "background": null, - "showCloseButton": "always", - "unfocusedBackground": null - }, - "window": - { - "applicationTheme": "dark", - "useMica": false - } - }, - { - "name": "legacyLight", - "tab": - { - "background": null, - "showCloseButton": "always", - "unfocusedBackground": null - }, - "window": - { - "applicationTheme": "light", - "useMica": false - } - }, - { - "name": "legacySystem", - "tab": - { - "background": null, - "showCloseButton": "always", - "unfocusedBackground": null - }, - "window": - { - "applicationTheme": "system", - "useMica": false - } - } - ], - "useAcrylicInTabRow": true, - "wordDelimiters": " ()\"',;<>!@#$%^&*|+=[]{}~?\u2502" + { + "command": "unbound", + "keys": "ctrl+v" + }, + { + "command": "unbound", + "keys": "ctrl+c" + }, + { + "command": "paste" + }, + { + "command": "find", + "keys": "ctrl+shift+f" + }, + { + "command": { + "action": "splitPane", + "split": "auto", + "splitMode": "duplicate" + }, + "keys": "alt+shift+d" + } + ], + "copyFormatting": "none", + "copyOnSelect": true, + "defaultProfile": "{48946353-ebe8-4571-a591-7d609f31327a}", + "newTabMenu": [ + { + "type": "remainingProfiles" + } + ], + "profiles": { + "defaults": { + "colorScheme": "One Half Dark", + "font": { + "face": "Cascadia Code" + } + }, + "list": [ + { + "colorScheme": "One Half Dark", + "commandline": "cmd /k \"%WT_SETTINGS_DIR%\\..\\..\\init.bat\"", + "guid": "{48946353-ebe8-4571-a591-7d609f31327a}", + "hidden": false, + "icon": "%WT_SETTINGS_DIR%\\..\\..\\..\\icons\\cmder.ico", + "name": "Cmder", + "startingDirectory": null, + "tabTitle": "Cmder", + "useAtlasEngine": false + }, + { + "colorScheme": "One Half Dark", + "commandline": "%SystemRoot%\\System32\\cmd.exe /k \"%WT_SETTINGS_DIR%\\..\\..\\init.bat\"", + "elevate": true, + "guid": "{bdd957d0-c15a-49e6-9816-14b02351a071}", + "hidden": false, + "icon": "%WT_SETTINGS_DIR%\\..\\..\\..\\icons\\cmder_red.ico", + "name": "Cmder as Admin", + "startingDirectory": null, + "tabTitle": "Cmder as Admin" + }, + { + "colorScheme": "One Half Dark", + "commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%WT_SETTINGS_DIR%\\..\\..\\profile.ps1'''\"", + "guid": "{eb1f6578-ce9d-47a9-a8c7-9b3fdd22302d}", + "hidden": false, + "icon": "%WT_SETTINGS_DIR%\\..\\..\\..\\icons\\cmder_orange.ico", + "name": "Cmder - PowerShell", + "startingDirectory": null, + "tabTitle": "Cmder", + "useAtlasEngine": false + }, + { + "colorScheme": "One Half Dark", + "commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%WT_SETTINGS_DIR%\\..\\..\\profile.ps1'''\"", + "elevate": true, + "guid": "{c5225c3e-8619-4145-8182-2800814eeb17}", + "hidden": false, + "icon": "%WT_SETTINGS_DIR%\\..\\..\\..\\icons\\cmder_purple.ico", + "name": "Cmder - PowerShell as Admin", + "startingDirectory": null, + "tabTitle": "Cmder - PowerShell as Admin", + "useAtlasEngine": false + }, + { + "colorScheme": "One Half Dark", + "commandline": "%WT_SETTINGS_DIR%\\..\\..\\start_git_bash.cmd", + "guid": "{c5c298e9-010e-4b8c-bc55-e3df81846b4c}", + "hidden": false, + "icon": "%WT_SETTINGS_DIR%\\..\\..\\..\\icons\\cmder_blue.ico", + "name": "Cmder - Bash", + "startingDirectory": null, + "tabTitle": "Cmder - Bash" + }, + { + "colorScheme": "One Half Dark", + "commandline": "%WT_SETTINGS_DIR%\\..\\..\\start_git_bash.cmd", + "elevate": true, + "guid": "{545eb9ed-4c1c-49b3-8cc6-7eb41bd280ff}", + "hidden": false, + "icon": "%WT_SETTINGS_DIR%\\..\\..\\..\\icons\\cmder_yellow.ico", + "name": "Cmder - Bash as Admin", + "startingDirectory": null, + "tabTitle": "Cmder - Bash as Admin" + }, + { + "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", + "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", + "hidden": false, + "name": "Windows PowerShell" + }, + { + "commandline": "%SystemRoot%\\System32\\cmd.exe", + "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", + "hidden": false, + "name": "Command Prompt" + } + ] + }, + "schemes": [ + { + "background": "#0C0C0C", + "black": "#0C0C0C", + "blue": "#0037DA", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#B4009E", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#CCCCCC", + "green": "#13A10E", + "name": "Campbell", + "purple": "#881798", + "red": "#C50F1F", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + }, + { + "background": "#012456", + "black": "#0C0C0C", + "blue": "#0037DA", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#B4009E", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#CCCCCC", + "green": "#13A10E", + "name": "Campbell Powershell", + "purple": "#881798", + "red": "#C50F1F", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + }, + { + "background": "#282828", + "black": "#282828", + "blue": "#458588", + "brightBlack": "#928374", + "brightBlue": "#83A598", + "brightCyan": "#8EC07C", + "brightGreen": "#B8BB26", + "brightPurple": "#D3869B", + "brightRed": "#FB4934", + "brightWhite": "#EBDBB2", + "brightYellow": "#FABD2F", + "cursorColor": "#FFFFFF", + "cyan": "#689D6A", + "foreground": "#EBDBB2", + "green": "#98971A", + "name": "Gruvbox Dark", + "purple": "#B16286", + "red": "#CC241D", + "selectionBackground": "#FFFFFF", + "white": "#A89984", + "yellow": "#D79921" + }, + { + "background": "#272822", + "black": "#3E3D32", + "blue": "#03395C", + "brightBlack": "#272822", + "brightBlue": "#66D9EF", + "brightCyan": "#66D9EF", + "brightGreen": "#A6E22E", + "brightPurple": "#AE81FF", + "brightRed": "#F92672", + "brightWhite": "#F8F8F2", + "brightYellow": "#FD971F", + "cursorColor": "#FFFFFF", + "cyan": "#66D9EF", + "foreground": "#F8F8F2", + "green": "#A6E22E", + "name": "Monokai", + "purple": "#AE81FF", + "red": "#F92672", + "selectionBackground": "#FFFFFF", + "white": "#F8F8F2", + "yellow": "#FFE792" + }, + { + "background": "#282C34", + "black": "#282C34", + "blue": "#61AFEF", + "brightBlack": "#5A6374", + "brightBlue": "#61AFEF", + "brightCyan": "#56B6C2", + "brightGreen": "#98C379", + "brightPurple": "#C678DD", + "brightRed": "#E06C75", + "brightWhite": "#DCDFE4", + "brightYellow": "#E5C07B", + "cursorColor": "#FFFFFF", + "cyan": "#56B6C2", + "foreground": "#DCDFE4", + "green": "#98C379", + "name": "One Half Dark", + "purple": "#C678DD", + "red": "#E06C75", + "selectionBackground": "#FFFFFF", + "white": "#DCDFE4", + "yellow": "#E5C07B" + }, + { + "background": "#FAFAFA", + "black": "#383A42", + "blue": "#0184BC", + "brightBlack": "#4F525D", + "brightBlue": "#61AFEF", + "brightCyan": "#56B5C1", + "brightGreen": "#98C379", + "brightPurple": "#C577DD", + "brightRed": "#DF6C75", + "brightWhite": "#FFFFFF", + "brightYellow": "#E4C07A", + "cursorColor": "#4F525D", + "cyan": "#0997B3", + "foreground": "#383A42", + "green": "#50A14F", + "name": "One Half Light", + "purple": "#A626A4", + "red": "#E45649", + "selectionBackground": "#FFFFFF", + "white": "#FAFAFA", + "yellow": "#C18301" + }, + { + "background": "#002B36", + "black": "#002B36", + "blue": "#268BD2", + "brightBlack": "#073642", + "brightBlue": "#839496", + "brightCyan": "#93A1A1", + "brightGreen": "#586E75", + "brightPurple": "#6C71C4", + "brightRed": "#CB4B16", + "brightWhite": "#FDF6E3", + "brightYellow": "#657B83", + "cursorColor": "#FFFFFF", + "cyan": "#2AA198", + "foreground": "#839496", + "green": "#859900", + "name": "Solarized Dark", + "purple": "#D33682", + "red": "#DC322F", + "selectionBackground": "#FFFFFF", + "white": "#EEE8D5", + "yellow": "#B58900" + }, + { + "background": "#FDF6E3", + "black": "#002B36", + "blue": "#268BD2", + "brightBlack": "#073642", + "brightBlue": "#839496", + "brightCyan": "#93A1A1", + "brightGreen": "#586E75", + "brightPurple": "#6C71C4", + "brightRed": "#CB4B16", + "brightWhite": "#FDF6E3", + "brightYellow": "#657B83", + "cursorColor": "#002B36", + "cyan": "#2AA198", + "foreground": "#657B83", + "green": "#859900", + "name": "Solarized Light", + "purple": "#D33682", + "red": "#DC322F", + "selectionBackground": "#FFFFFF", + "white": "#EEE8D5", + "yellow": "#B58900" + }, + { + "background": "#000000", + "black": "#000000", + "blue": "#3465A4", + "brightBlack": "#555753", + "brightBlue": "#729FCF", + "brightCyan": "#34E2E2", + "brightGreen": "#8AE234", + "brightPurple": "#AD7FA8", + "brightRed": "#EF2929", + "brightWhite": "#EEEEEC", + "brightYellow": "#FCE94F", + "cursorColor": "#FFFFFF", + "cyan": "#06989A", + "foreground": "#D3D7CF", + "green": "#4E9A06", + "name": "Tango Dark", + "purple": "#75507B", + "red": "#CC0000", + "selectionBackground": "#FFFFFF", + "white": "#D3D7CF", + "yellow": "#C4A000" + }, + { + "background": "#FFFFFF", + "black": "#000000", + "blue": "#3465A4", + "brightBlack": "#555753", + "brightBlue": "#729FCF", + "brightCyan": "#34E2E2", + "brightGreen": "#8AE234", + "brightPurple": "#AD7FA8", + "brightRed": "#EF2929", + "brightWhite": "#EEEEEC", + "brightYellow": "#FCE94F", + "cursorColor": "#000000", + "cyan": "#06989A", + "foreground": "#555753", + "green": "#4E9A06", + "name": "Tango Light", + "purple": "#75507B", + "red": "#CC0000", + "selectionBackground": "#FFFFFF", + "white": "#D3D7CF", + "yellow": "#C4A000" + }, + { + "background": "#000000", + "black": "#000000", + "blue": "#000080", + "brightBlack": "#808080", + "brightBlue": "#0000FF", + "brightCyan": "#00FFFF", + "brightGreen": "#00FF00", + "brightPurple": "#FF00FF", + "brightRed": "#FF0000", + "brightWhite": "#FFFFFF", + "brightYellow": "#FFFF00", + "cursorColor": "#FFFFFF", + "cyan": "#008080", + "foreground": "#C0C0C0", + "green": "#008000", + "name": "Vintage", + "purple": "#800080", + "red": "#800000", + "selectionBackground": "#FFFFFF", + "white": "#C0C0C0", + "yellow": "#808000" + } + ], + "themes": [], + "useAcrylicInTabRow": true, + "wordDelimiters": " ()\"',;<>!@#$%^&*|+=[]{}~?\u2502" } From db3889d5e5e8df85c7ffbcf932941d0955b0b193 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 30 May 2024 16:27:43 -0400 Subject: [PATCH 54/65] remove vendor/start_git_mintty.cmd --- vendor/start_git_mintty.cmd | 40 ------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 vendor/start_git_mintty.cmd diff --git a/vendor/start_git_mintty.cmd b/vendor/start_git_mintty.cmd deleted file mode 100644 index ea4f09a9f..000000000 --- a/vendor/start_git_mintty.cmd +++ /dev/null @@ -1,40 +0,0 @@ -@echo off - -if not defined CMDER_ROOT ( - if defined ConEmuDir ( - for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( - set "CMDER_ROOT=%%~fi" - ) - ) else ( - for /f "delims=" %%i in ("%~dp0\..") do ( - set "CMDER_ROOT=%%~fi" - ) - ) -) - -if exist "%CMDER_ROOT%\vendor\git-for-windows" ( - set "PATH=%CMDER_ROOT%\vendor\git-for-windows\usr\bin;%PATH%" - set "gitCmd=%CMDER_ROOT%\vendor\git-for-windows\usr\bin\mintty.exe" -) else if exist "%ProgramFiles%\git" ( - set "PATH=%ProgramFiles%\git\usr\bin;%PATH%" - set "gitCmd=%ProgramFiles%\git\usr\bin\mintty.exe" - if not exist "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" ( - echo Run 'mklink "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash - echo. - echo or - echo. - echo Run 'echo "" ^> "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. - ) -) else if exist "%ProgramFiles(x86)%\git" ( - set "PATH=%ProgramFiles(x86)%\git\usr\bin;%PATH%" - set "gitCmd=%ProgramFiles(x86)%\git\usr\bin\mintty.exe" - if not exist "%ProgramFiles(x86)%\git\etc\profile.d\cmder_exinit.sh" ( - echo Run 'mklink "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash - echo. - echo or - echo. - echo Run 'echo "" ^> "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. - ) -) - -"%gitCmd%" /bin/bash -l From e850f8241da92c627428fd85bdf75b74cf095cb9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 30 May 2024 16:37:37 -0400 Subject: [PATCH 55/65] add vendor/start_git_mintty.cmd --- vendor/start_git_mintty.cmd | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 vendor/start_git_mintty.cmd diff --git a/vendor/start_git_mintty.cmd b/vendor/start_git_mintty.cmd new file mode 100644 index 000000000..ea4f09a9f --- /dev/null +++ b/vendor/start_git_mintty.cmd @@ -0,0 +1,40 @@ +@echo off + +if not defined CMDER_ROOT ( + if defined ConEmuDir ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) else ( + for /f "delims=" %%i in ("%~dp0\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) +) + +if exist "%CMDER_ROOT%\vendor\git-for-windows" ( + set "PATH=%CMDER_ROOT%\vendor\git-for-windows\usr\bin;%PATH%" + set "gitCmd=%CMDER_ROOT%\vendor\git-for-windows\usr\bin\mintty.exe" +) else if exist "%ProgramFiles%\git" ( + set "PATH=%ProgramFiles%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles%\git\usr\bin\mintty.exe" + if not exist "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) else if exist "%ProgramFiles(x86)%\git" ( + set "PATH=%ProgramFiles(x86)%\git\usr\bin;%PATH%" + set "gitCmd=%ProgramFiles(x86)%\git\usr\bin\mintty.exe" + if not exist "%ProgramFiles(x86)%\git\etc\profile.d\cmder_exinit.sh" ( + echo Run 'mklink "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh" "%CMDER_ROOT%\vendor\cmder_exinit"' in 'cmd::Cmder as Admin' to use Cmder with external Git Bash + echo. + echo or + echo. + echo Run 'echo "" ^> "%ProgramFiles^(x86^)%\git\etc\profile.d\cmder_exinit.sh"' in 'cmd::Cmder as Admin' to disable this message. + ) +) + +"%gitCmd%" /bin/bash -l From 2e945fb02b59feada837852007f0c678585f46f9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 31 May 2024 18:31:16 -0400 Subject: [PATCH 56/65] Fix launcher overwritting/backing up emulator settings --- launcher/src/CmderLauncher.cpp | 119 ++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 53 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index b0e8c91ce..055f7db1c 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -290,60 +290,66 @@ 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 +366,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 +389,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 +416,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." @@ -430,20 +439,23 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) - { - 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!", MB_TITLE, MB_ICONSTOP); - exit(1); + else { + if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) + { + 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!", MB_TITLE, MB_ICONSTOP); + 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 +474,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 (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." From 82ab068f12ecf7f020ac8d4365d1f1408c8f2e23 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 15 Aug 2024 10:24:02 -0400 Subject: [PATCH 57/65] cleanup --- launcher/src/CmderLauncher.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 055f7db1c..e1aa2d559 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -298,8 +298,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { if (!CopyFile(cfgPath, cpuCfgPath, 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_%COMPUTERNAME%_settings.json! Access Denied." @@ -320,8 +319,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { - if (PathFileExists(windowsTerminalDir)) - { + 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." @@ -348,8 +346,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { 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." @@ -370,8 +367,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { 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." @@ -399,8 +395,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { 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." @@ -420,8 +415,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { 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." @@ -439,8 +433,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else { - if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) + else if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) @@ -454,8 +447,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { 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." @@ -478,8 +470,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { 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." From f4f6255c1a9dd16b2e0fa68c469790842e07fe8e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 20 Aug 2024 12:25:33 +0000 Subject: [PATCH 58/65] remove extra {} --- launcher/src/CmderLauncher.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index e1aa2d559..1a70b4a09 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -434,13 +434,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } else if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) - { - 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!", MB_TITLE, MB_ICONSTOP); - exit(1); - } + { + 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!", MB_TITLE, MB_ICONSTOP); + exit(1); } } 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. @@ -468,7 +467,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } 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)) { MessageBox(NULL, From ebce8479ef7736b591d81b1c53517f1063706953 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 29 Dec 2024 16:23:59 -0500 Subject: [PATCH 59/65] origin/fix_launcher_overwrite --- launcher/src/CmderLauncher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 1a70b4a09..94a719f32 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -290,7 +290,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } - 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 ( 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 { @@ -315,7 +315,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else // [terminal emulator config] file does not exist, copy config/[cpu specific terminal emulator config] file to [terminal emulator config] file + else // [terminal emulator config] file does not exist, copy config/[host specific terminal emulator config] file to [terminal emulator config] file { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { From 8ea276d9bd3ebf1b57c3de1854cb6626d134aeda Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 1 Jan 2025 22:15:34 -0500 Subject: [PATCH 60/65] not set --- launcher/src/CmderLauncher.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index b0e8c91ce..cc1c3ea47 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -289,8 +289,12 @@ 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"); } + + // Check if the user has specified a config file to use + // If cpuCfgPath is set and exists, use it. + // If userCfgPath is set and exists, use it. - 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/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config. { if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { @@ -335,7 +339,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - 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_conemu.xml exists, use it. { if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { @@ -439,7 +443,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr 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)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { @@ -462,7 +466,7 @@ 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/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'. { if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE)) { From 9b5be7bd53c09c9b4af384a080cb54f0e3784ce9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 1 Jan 2025 22:29:41 -0500 Subject: [PATCH 61/65] cleanup --- launcher/src/CmderLauncher.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 1e15e29f1..2b18ad2ab 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -290,10 +290,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } - // Check if the user has specified a config file to use - // If cpuCfgPath is set and exists, use it. - // If userCfgPath is set and exists, use it. - 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 From 05f616fd769fb5874159c9937e83912c478399df Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 1 Jan 2025 22:32:37 -0500 Subject: [PATCH 62/65] cleanup --- launcher/src/CmderLauncher.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 2b18ad2ab..f565f4786 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -436,9 +436,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr else if (!CopyFile(defaultCfgPath, cfgPath, FALSE) && PathFileExists(conEmuDir)) { 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!", MB_TITLE, MB_ICONSTOP); + (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!", MB_TITLE, MB_ICONSTOP); exit(1); } } From 74d7dd211f2c204cd00b2d0c4ebdd1e7ca4d0c5a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 1 Jan 2025 22:49:02 -0500 Subject: [PATCH 63/65] cleanup --- launcher/src/CmderLauncher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index f565f4786..8d7864feb 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -437,7 +437,7 @@ 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); } From 06349694f03d88c3b72201fd96784052305be871 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Jan 2025 19:46:59 -0500 Subject: [PATCH 64/65] CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b22a1917..6962c14fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## Unreleased + +### Fixes + +- Fixes [[Bug] development builds cmder.exe always overwrites the terminal emulator settings files.](#2940) + ## [1.3.20](https://github.com/cmderdev/cmder/tree/v1.3.20) (2022-03-18) ### Changes From b4120362621feaf37b786388a3a3a7065dfa35ea Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Jan 2025 19:52:28 -0500 Subject: [PATCH 65/65] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6962c14fa..c8fd4eae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixes -- Fixes [[Bug] development builds cmder.exe always overwrites the terminal emulator settings files.](#2940) +- Fixes #2940 ## [1.3.20](https://github.com/cmderdev/cmder/tree/v1.3.20) (2022-03-18)