Use File.realpath when validating install location

File.expand_path will not remove extra / from input directories, so
File.realpath is used first to remove these extra entries.

Unfortunately it is not available on ruby 1.8.7, so I'm unsure how to
make a safe check for this for old ruby.

Issue #508