From 59817efa8e659c5c7adce2991980e5e38e737178 Mon Sep 17 00:00:00 2001 From: Acho Arnold Ewin Date: Tue, 7 Jul 2026 10:26:26 +0300 Subject: [PATCH] fix: correctly resolve PREFIX when git.exe is under the arch dir in PATH When 'where git.exe' resolves to ...\mingw64\bin\git.exe or ...\clangarm64\bin\git.exe, installdir becomes the architecture directory itself. Detect that case by inspecting the leaf directory name instead of appending mingw64/clangarm64 (which produced non-existent ...\mingw64\mingw64 paths) or using ..\ segments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- install.cmd | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/install.cmd b/install.cmd index b4b4df2..df60d90 100644 --- a/install.cmd +++ b/install.cmd @@ -39,16 +39,21 @@ goto :defaultpath rem remove the last slash SET bindir=%bindir:~0,-1% for %%G in ("%bindir%") do set installdir=%%~dpG -if exist "%installdir%mingw64" ( - set PREFIX=%installdir%mingw64 -) else if exist "%installdir%clangarm64" ( - set PREFIX=%installdir%clangarm64 -) else if exist "%installdir%..\mingw64" ( - set PREFIX=%installdir%..\mingw64 -) else if exist "%installdir%..\clangarm64" ( - set PREFIX=%installdir%..\clangarm64 +rem strip a trailing slash so we can inspect the leaf directory name +if "%installdir:~-1%"=="\" set installdir=%installdir:~0,-1% +rem git.exe found under \mingw64\bin or \clangarm64\bin +rem means installdir already is the architecture directory itself +for %%G in ("%installdir%") do set archdir=%%~nxG +if /I "%archdir%"=="mingw64" ( + set PREFIX=%installdir% +) else if /I "%archdir%"=="clangarm64" ( + set PREFIX=%installdir% +) else if exist "%installdir%\mingw64" ( + set PREFIX=%installdir%\mingw64 +) else if exist "%installdir%\clangarm64" ( + set PREFIX=%installdir%\clangarm64 ) else ( - set PREFIX=%installdir%mingw64 + set PREFIX=%installdir%\mingw64 ) goto :foundprefix