Skip to content

Commit

Permalink
Tweak if This Script is Renamed
Browse files Browse the repository at this point in the history
In programs like ConEmu, very often users want to pass their own options
into Clink. This involves replacing clink.bat with their own custom one,
which will then call the original clink.bat with a new name. This tweak
keeps the original behavior of looking for clinkXXX_x64.exe when the
batch script is named clinkXXX.bat, but provides a fallback for it to
run clink_x64.exe if clinkXXX_x64.exe cannot be found.
  • Loading branch information
Russ Frizzell-Carlton committed Oct 14, 2015
1 parent 1abb576 commit 5105c83
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions clink/loader/clink.bat
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,24 @@ goto :eof
:loader_x86
if exist "%~dpn0_x86.exe" (
"%~dpn0_x86.exe" %*
)
) else if exist "%~dp0clink_x86.exe" (
"%~dp0clink_x86.exe" %*
)
exit /b 0

:loader_x64
if exist "%~dpn0_x64.exe" (
"%~dpn0_x64.exe" %*
) else if exist "%~dp0clink_x64.exe" (
"%~dp0clink_x64.exe" %*
)
exit /b 0

:launch
start "" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg% && title Clink"
if exist "%~dpn0*.exe" (
start "" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg% && title Clink"
)
else (
start "" cmd.exe /s /k "%~dp0clink inject %clink_profile_arg% && title Clink"
)
exit /b 0

0 comments on commit 5105c83

Please sign in to comment.