Fix absolute paths

This commit is contained in:
xypwn 2020-12-13 12:52:17 +01:00
parent 8be86e51f2
commit b006238127
2 changed files with 8 additions and 6 deletions

View File

@ -6,4 +6,4 @@
YOUTUBE_DL="./yt-dlc/youtube-dlc"
# Where the downloaded videos will get stored
SAVEDIR="./downloads"
OUTDIR="./downloads"

View File

@ -2,9 +2,13 @@
source "$(dirname $0)/config.sh"
# We need absolute paths, since we'll be changing directories later
YOUTUBE_DL="$(readlink -f $(dirname $0))/$YOUTUBE_DL"
OUTDIR="$(readlink -f $(dirname $0))/$SAVEDIR"
[ ! -e "$(dirname $0)/$OUTDIR" ] && mkdir -p "$(dirname $0)/$OUTDIR"
# Turn paths into absolute ones, if they aren't already, as we will change directories later
[ ! "${SAVEDIR::1}" = "/" ] &&
OUTDIR="$(readlink -f $(dirname $0)/$OUTDIR)"
[ ! "${YOUTUBE_DL::1}" = "/" ] &&
YOUTUBE_DL="$(readlink -f $(dirname $0)/$YOUTUBE_DL)"
p_info() {
echo -e "\e[32m>>> $@\e[m"
@ -160,8 +164,6 @@ download_all() {
done
}
[ ! -e "$OUTDIR" ] && mkdir -p "$OUTDIR"
if [ -n "$OPT_SEASON" ]; then
get_season_url "$OPT_SEASON"
[ -z "$RES" ] &&