diff --git a/lib.sh b/lib.sh index 820641d..bdb8897 100644 --- a/lib.sh +++ b/lib.sh @@ -2,24 +2,26 @@ # lib_get_esptool_command() { + WIN_PYTHON="py.exe" if command -v esptool.py &> /dev/null then echo "esptool.py" else - if ! command -v py.exe &> /dev/null + if ! command -v $WIN_PYTHON &> /dev/null then - echo "esptool.py nor py.exe could not be found. Please install it first." + echo "esptool.py nor $WIN_PYTHON could not be found. Please install it first." exit 1 fi # check if esptool is installed as a module if py.exe -m esptool --help &> /dev/null then - echo "py.exe -m esptool" + echo "$WIN_PYTHON -m esptool" + return else echo "install esptool module for python first." - py.exe -m pip install esptool + $WIN_PYTHON -m pip install esptool fi - echo "py.exe -m esptool" + echo "$WIN_PYTHON -m esptool" fi }