Skip to content

Commit

Permalink
Update dotnet-local script to work from any directory. (#6884)
Browse files Browse the repository at this point in the history
The current `docnet-local` scripts relied on being run from the
same directory. This change uses the script location to run the
exists checks and to execute the `dotnet` binary. This way we can
run this from any directory.
  • Loading branch information
dellis1972 authored Mar 31, 2022
1 parent 7982895 commit b7db52b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions dotnet-local.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@echo off

IF EXIST "bin\Release\dotnet\dotnet.exe" (
call "bin\Release\dotnet\dotnet.exe" %*
) ELSE IF EXIST "bin\Debug\dotnet\dotnet.exe" (
call "bin\Debug\dotnet\dotnet.exe" %*
SET ROOT=%~dp0
IF EXIST "%ROOT%\bin\Release\dotnet\dotnet.exe" (
call "%ROOT%\bin\Release\dotnet\dotnet.exe" %*
) ELSE IF EXIST "%ROOT%\bin\Debug\dotnet\dotnet.exe" (
call "%ROOT%\bin\Debug\dotnet\dotnet.exe" %*
) ELSE (
echo "You need to run 'msbuild Xamarin.Android.sln /t:Prepare' first."
)
9 changes: 5 additions & 4 deletions dotnet-local.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
if [[ -x "bin/Release/dotnet/dotnet" ]]; then
exec ./bin/Release/dotnet/dotnet "$@"
elif [[ -x "bin/Debug/dotnet/dotnet" ]]; then
exec ./bin/Debug/dotnet/dotnet "$@"
ROOT=$(dirname "${BASH_SOURCE}")
if [[ -x "${ROOT}/bin/Release/dotnet/dotnet" ]]; then
exec ${ROOT}/bin/Release/dotnet/dotnet "$@"
elif [[ -x "${ROOT}/bin/Debug/dotnet/dotnet" ]]; then
exec ${ROOT}/bin/Debug/dotnet/dotnet "$@"
else
echo "You need to run 'make prepare' first."
fi

0 comments on commit b7db52b

Please sign in to comment.