cd KNOWN_DIR before executing any functions or tools

It is fucking amazing how much shit breaks if CWD is invalid. Fucking amazing.

Also fuck you dumb user who can't figure out what "No such file or directory - getcwd" means so you force me to waste half an hour fixing it for you.
This commit is contained in:
Max Howell 2011-08-29 10:24:12 +01:00
parent 63d8cb1a6b
commit cadc0506f9

View File

@ -66,6 +66,10 @@ def macos_version
@macos_version ||= /(10\.\d+)(\.\d+)?/.match(`/usr/bin/sw_vers -productVersion`).captures.first.to_f
end
# The block form of Dir.chdir fails later if Dir.CWD doesn't exist which I
# guess is fair enough. Also sudo prints a warning message for no good reason
Dir.chdir "/usr"
####################################################################### script
abort "MacOS too old, see: https://gist.github.com/1144389" if macos_version < 10.5
abort "/usr/local/.git already exists!" unless Dir["/usr/local/.git/*"].empty?