Use File.realpath to handle symlinks