X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=bin%2Fwhatever-dl;h=79cbbee15afb9785a5f2ff5085b94392894dcdbb;hb=683a3d565af34bd0fc63c659e8647707d466d7d9;hp=a59e61b2d56a0c92ef5187315f1192456aa4e6fe;hpb=5359bc2a58320794c5d6d91acb39eac4f371c9c2;p=dead%2Fwhatever-dl.git diff --git a/bin/whatever-dl b/bin/whatever-dl index a59e61b..79cbbee 100755 --- a/bin/whatever-dl +++ b/bin/whatever-dl @@ -19,6 +19,18 @@ # http://www.fsf.org/licensing/licenses/gpl.html # +# We need Pathname to get the real filesystem path +# of this script (and not, for example, the path of +# a symlink which points to it. +require 'pathname' + +# This bit of magic adds the parent directory (the +# project root) to the list of ruby load paths. +# Thus, our require statements will work regardless of +# how or from where the script was run. +executable = Pathname.new(__FILE__).realpath.to_s +$: << File.dirname(executable) + '/../' + # We require the UriUtilities class to handle # the download of the video URL. require 'src/uri_utilities'