Compare commits

...

10 Commits

Author SHA1 Message Date
David Refoua
f6eb7aa4f8 Improve path enhancement handling in lib_path.cmd
Refactor path enhancement logic for clarity and robustness.
2025-11-06 18:26:41 +03:30
David Refoua
6f6c21dcae add missing prefix 2025-11-06 18:23:10 +03:30
David Refoua
f6bc623284 fix line endings 2025-11-06 18:13:33 +03:30
David Refoua
006567cdbc fix inconsistencies 2025-11-06 18:07:13 +03:30
David Refoua
75d6973ccf Merge pull request #3029 from cmderdev/dependabot/github_actions/github/codeql-action-4
Bump github/codeql-action from 3 to 4
2025-11-06 17:35:10 +03:30
David Refoua
1bcba81bec Merge pull request #3032 from cmderdev/dependabot/github_actions/actions/upload-artifact-5
Bump actions/upload-artifact from 4 to 5
2025-11-06 17:34:32 +03:30
David Refoua
e7f102bdee avoid temp filename collisions 2025-11-06 17:09:40 +03:30
David Refoua
a7c0e0642d implement fix suggested in https://github.com/cmderdev/cmder/issues/2990#issuecomment-3496143288 2025-11-06 16:59:58 +03:30
dependabot[bot]
1940e97ddc Bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 15:37:27 +00:00
dependabot[bot]
066203dbdc Bump github/codeql-action from 3 to 4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-13 15:33:31 +00:00
7 changed files with 54 additions and 33 deletions

View File

@@ -53,26 +53,26 @@ jobs:
run: .\pack.ps1 -verbose
- name: Upload artifact (cmder.zip)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
path: build/cmder.zip
name: cmder.zip
if-no-files-found: error
- name: Upload artifact (cmder.7z)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
path: build/cmder.7z
name: cmder.7z
- name: Upload artifact (cmder_mini.zip)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
path: build/cmder_mini.zip
name: cmder_mini.zip
- name: Upload artifact (hashes.txt)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
path: build/hashes.txt
name: hashes.txt

View File

@@ -49,7 +49,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,6 +68,6 @@ jobs:
run: .\build.ps1 -Compile -verbose
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"

View File

@@ -4,7 +4,7 @@ set lib_base=call "%~dp0lib_base.cmd"
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (
) else if "%~1" neq "" (
call :%*
)

View File

@@ -14,7 +14,7 @@ if %fast_init% gtr %verbose_output% if %fast_init% gtr %debug_output% exit /b
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (
) else if "%~1" neq "" (
call :%*
)

View File

@@ -1,12 +1,12 @@
@echo off
call "%~dp0lib_base.cmd"
call "%%~dp0lib_console.cmd"
call "%~dp0lib_console.cmd"
set lib_git=call "%~dp0lib_git.cmd"
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (
) else if "%~1" neq "" (
call :%*
)

View File

@@ -1,12 +1,12 @@
@echo off
call "%~dp0lib_base.cmd"
call "%%~dp0lib_console"
call "%~dp0lib_console.cmd"
set lib_path=call "%~dp0lib_path.cmd"
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (
) else if "%~1" neq "" (
call :%*
)
@@ -48,7 +48,7 @@ exit /b
set "add_path=%~1"
) else (
%print_error% "You must specify a directory to add to the path!"
exit 1
exit /b 1
)
if "%~2" neq "" if /i "%~2" == "append" (
@@ -72,7 +72,7 @@ exit /b
set "PATH=%add_to_path%;%PATH%"
)
goto :end_enhance_path
) else if "add_to_path" equ "" (
) else if "%add_to_path%" equ "" (
goto :end_enhance_path
)
@@ -84,20 +84,20 @@ exit /b
setlocal enabledelayedexpansion
if "!found!" == "0" (
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
call :set_found
)
%print_debug% :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
if /i "!position!" == "append" (
if "!found!" == "0" (
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$"
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!$"
call :set_found
)
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
) else (
if "!found!" == "0" (
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;"
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:"^!find_query!;"
call :set_found
)
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
@@ -119,7 +119,8 @@ exit /b
:end_enhance_path
set "PATH=%PATH:;;=;%"
REM echo %path%|"C:\Users\dgames\cmder - dev\vendor\git-for-windows\usr\bin\wc" -c
REM echo %path%|wc -c
if "%fast_init%" == "1" exit /b
if not "%OLD_PATH:~0,3000%" == "%OLD_PATH:~0,3001%" goto :toolong
@@ -127,15 +128,22 @@ exit /b
exit /b
:toolong
echo "%OLD_PATH%">"%temp%\cmder_lib_pathA"
echo "%PATH%">"%temp%\cmder_lib_pathB"
fc /b "%temp%\cmder_lib_pathA" "%temp%\cmder_lib_pathB" 2>nul 1>nul
if errorlevel 1 ( del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" & goto :changed )
del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB"
set "_rand=%RANDOM%"
if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" 2>nul 1>nul
if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
if exist "%temp%\%_rand%_cmder_lib_pathA" goto :toolong
if exist "%temp%\%_rand%_cmder_lib_pathB" goto :toolong
echo "%OLD_PATH%">"%temp%\%_rand%_cmder_lib_pathA"
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & goto :toolong )
echo "%PATH%">"%temp%\%_rand%_cmder_lib_pathB"
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" & goto :toolong )
fc /b "%temp%\%_rand%_cmder_lib_pathA" "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
if errorlevel 1 ( del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand=" & goto :changed )
del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand="
exit /b
:changed
%print_debug% :enhance_path "END Env Var - PATH=%path%"
%print_debug% :enhance_path "END Env Var - PATH=%PATH%"
%print_debug% :enhance_path "Env Var %find_query% - found=%found%"
exit /b
@@ -179,16 +187,31 @@ exit /b
set "add_path=%~1"
) else (
%print_error% "You must specify a directory to add to the path!"
exit 1
exit /b 1
)
rem Parse arguments robustly:
rem Accept either public form: "[dir_path]" [max_depth] [append]
rem or internal recursive form: "[dir_path]" [depth] [max_depth] [append]
set "depth=%~2"
set "max_depth=%~3"
if "%~4" neq "" if /i "%~4" == "append" (
set "position=%~4"
) else (
set "position="
if /i "%~4" == "append" set "position=append"
if /i "%~3" == "append" (
set "position=append"
set "max_depth="
)
if not defined depth set "depth=0"
if not defined max_depth (
if defined depth (
rem If only one numeric argument provided, treat it as max_depth
set "max_depth=%depth%"
set "depth=0"
) else (
set "max_depth=1"
)
)
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
@@ -224,8 +247,6 @@ exit /b
call :loop_depth
)
set "PATH=%PATH%"
exit /b
:set_depth

View File

@@ -1,12 +1,12 @@
@echo off
call "%~dp0lib_base.cmd"
call "%%~dp0lib_console"
call "%~dp0lib_console.cmd"
set lib_profile=call "%~dp0lib_profile.cmd"
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (
) else if "%~1" neq "" (
call :%*
)