Don't look broken if CWD doesn't exist

Ruby throws if CWD doesn't exist, even when you aren't doing anything related to the CWD. Sucks. So at least show the user a friendly error message rather than looking broken.
This commit is contained in:
Max Howell 2009-10-23 14:49:48 +01:00
parent 1fcd449c6e
commit 5599316971

View File

@ -1,6 +1,10 @@
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
# Many Pathname operations use getwd when they shouldn't, and then throw
# odd exceptions. Reduce our support burden by showing a user-friendly error.
Dir.getwd rescue abort "The current working directory doesn't exist, cannot proceed."
def homebrew_rubylib_path
lib_path = "/../../Library/Homebrew"
# we resolve off of Dir.getwd as otherwise the symlink gets resolved!