allow symlinks to executable

This commit is contained in:
r4 2022-06-23 20:35:29 +02:00
parent 3f2dccee55
commit e631ad6009
2 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,8 @@
# South Park Downloader Configuration File #
############################################
# Relative or absolute paths are allowed. Please DON'T use ~/, but rather $HOME or /home/$USER.
# Absolute paths or paths relative to the executable are allowed.
# Please DON'T use ~/, but rather $HOME or /home/$USER.
# youtube-dl (or youtube-dlc) executable path
YOUTUBE_DL="./yt-dlc/youtube-dlc"

View File

@ -1,14 +1,17 @@
#!/usr/bin/env bash
source "$(dirname "$0")/config.sh"
# Resolve executable directory
DIR="$(dirname "$(readlink -e "$0")")"
# Turn paths into absolute ones, if they aren't already. Will be necessary, since we'll change directories later.
source "$DIR/config.sh"
# Turn paths into absolute ones if they aren't already. Will be necessary since we'll change directories later.
[ ! "${CACHEDIR::1}" = "/" ] &&
CACHEDIR="$(readlink -f "$(dirname "$0")/$CACHEDIR")"
CACHEDIR="$DIR/$CACHEDIR"
[ ! "${OUTDIR::1}" = "/" ] &&
OUTDIR="$(readlink -f "$(dirname "$0")/$OUTDIR")"
OUTDIR="$DIR/$OUTDIR"
[ ! "${YOUTUBE_DL::1}" = "/" ] &&
YOUTUBE_DL="$(readlink -f "$(dirname "$0")/$YOUTUBE_DL")"
YOUTUBE_DL="$DIR/$YOUTUBE_DL"
[ ! -e "$OUTDIR" ] && mkdir -p "$OUTDIR"
[ ! -e "$CACHEDIR" ] && mkdir -p "$CACHEDIR"