1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 17:58:41 +00:00

qb: Update the exists function.

This commit is contained in:
orbea 2020-01-14 10:20:07 -08:00
parent a6b114e423
commit d89b7f93b2

View File

@ -23,22 +23,29 @@ exists()
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
arg="$1" arg="$1"
shift 1 shift 1
case "$arg" in ''|*/) continue ;; esac case "$arg" in
x="${arg##*/}" ''|*/ )
z="${arg%/*}" :
[ ! -f "$z/$x" ] || [ ! -x "$z/$x" ] && [ "$z/$x" = "$arg" ] && ;;
continue */* )
[ "$x" = "$z" ] && [ -x "$z/$x" ] && [ ! -f "$arg" ] && z= if [ -f "$arg" ] && [ -x "$arg" ]; then
p=":$z:$PATH" printf %s\\n "$arg"
while [ "$p" != "${p#*:}" ]; do v=0
p="${p#*:}" fi
d="${p%%:*}" ;;
if [ -f "$d/$x" ] && [ -x "$d/$x" ]; then * )
printf %s\\n "$d/$x" p=":$PATH"
v=0 while [ "$p" != "${p#*:}" ]; do
break p="${p#*:}"
fi d="${p%%:*}/$arg"
done if [ -f "$d" ] && [ -x "$d" ]; then
printf %s\\n "$d"
v=0
break
fi
done
;;
esac
done done
return $v return $v
} }