Skip to content

Instantly share code, notes, and snippets.

@robyurkowski
Created December 2, 2010 15:50
Show Gist options
  • Save robyurkowski/725549 to your computer and use it in GitHub Desktop.
Save robyurkowski/725549 to your computer and use it in GitHub Desktop.
Lines for checking if symlinked, setting appropriate load path, and `chdir`ing for file reads
#!/usr/bin/env ruby
THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
$LOAD_PATH.unshift File.expand_path(File.dirname(THIS_FILE))
Dir.chdir(File.expand_path(File.dirname(THIS_FILE)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment