mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
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>
This commit is contained in:
parent
edfaa000f2
commit
59817efa8e
23
install.cmd
23
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 <GitRoot>\mingw64\bin or <GitRoot>\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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue