change find media function to be tail recursive?

This commit is contained in:
ksyasuda 2022-01-11 12:37:59 -08:00
parent e8944dcc69
commit e5bb21b4e1

View File

@ -407,16 +407,15 @@ find_media() {
return 1 return 1
;; ;;
*) *)
if [ -d "$inp/$selection" ] || [ -f "$inp/$selection" ]; then if [ ! -d "$inp/$selection" ] && [ ! -f "$inp/$selection" ]; then
return 1
else
insert_history "directory" "$inp/$selection" & insert_history "directory" "$inp/$selection" &
if [ "$inp" = "/" ]; then if [ "$inp" = "/" ]; then
find_media "/$selection" find_media "/$selection"
else else
find_media "$inp/$selection" find_media "$inp/$selection"
fi fi
return $?
else
return 1
fi fi
;; ;;
esac esac