idelsink / yad2ogg

Yet Another dir2ogg. Convert a directory to ogg

Home Page:https://github.com/idelsink/yad2ogg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error including file when calling script via a symlink

idelsink opened this issue · comments

When yad2ogg.sh is called via a symlink, it fails to include other stuff.
For example:
repo is in ~/software/yad2ogg
and a symlink ln ~/software/yad2ogg/yad2ogg.sh ~/bin/yad2ogg.sh.

To solve this, the include call need to solve this to a "real" path. I found a quick solution to use $(dirname $([ -L $0 ] && readlink -f $0 || echo $0)). Apparently this fails to work on OSX according to some people.
http://stackoverflow.com/questions/7665/how-to-resolve-symbolic-links-in-a-shell-script

I will fix this, but I don't know when. If you really want to use this via a symlink, change the following in yad2ogg.sh: SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" to SCRIPT_PATH="$( $(dirname $([ -L $0 ] && readlink -f $0 || echo $0)) )".
Hmm it seems that this is already something that I had planned to look at.

Also at the moment of writing this only go's for the devel branch. The master branch has the same issue, but the include command is a little bit different.