]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Fixed the relative path require issue. Now we should be able to symlink the main...
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 15 Nov 2008 23:46:54 +0000 (18:46 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 15 Nov 2008 23:46:54 +0000 (18:46 -0500)
bin/whatever-dl

index a59e61b2d56a0c92ef5187315f1192456aa4e6fe..79cbbee15afb9785a5f2ff5085b94392894dcdbb 100755 (executable)
 # 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'