zephyr-env.sh: only reset scripts_path on Windows

The pipeline that converts scripts_path from "C:\" style to "/c/"
style is only needed on Windows. Further, on Linux, it prepends an
extra "/" to what gets added to PATH, since the pwd output already has
a leading "/".

Fix that by only making the change when we're building on Windows.

Change-Id: Ied7e4491f171d82e8dee4c3a4dfdcf64adf46efd
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This commit is contained in:
Marti Bolivar 2017-03-31 15:26:25 -04:00
parent bfda8a966a
commit 5f95120779

View file

@ -35,14 +35,23 @@ fi
# .zephyrrc in your home directory. It will be automatically
# run (if it exists) by this script.
uname | grep -q -P "MINGW|MSYS" && PWD_OPT="-W"
if uname | grep -q -P "MINGW|MSYS"; then
win_build=1
PWD_OPT="-W"
else
win_build=0
PWD_OPT=""
fi
# identify OS source tree root directory
export ZEPHYR_BASE=$( builtin cd "$( dirname "$DIR" )" && pwd ${PWD_OPT})
unset PWD_OPT
scripts_path=${ZEPHYR_BASE}/scripts
scripts_path=$(echo "/$scripts_path" | sed 's/\\/\//g' | sed 's/://')
if [ "$win_build" -eq 1 ]; then
scripts_path=$(echo "/$scripts_path" | sed 's/\\/\//g' | sed 's/://')
fi
unset win_build
if ! echo "${PATH}" | grep -q "${scripts_path}"; then
export PATH=${scripts_path}:${PATH}
fi