Make sure the trust directory exists. If it does exist, make sure it’s
actually a directory. If not, then create it with the appropriate
permissions.
# File lib/rubygems/security.rb, line 655
def self.verify_trust_dir(path, perms)
# if the directory exists, then make sure it is in fact a directory. if
# it doesn't exist, then create it with the appropriate permissions
if File.exist?(path)
# verify that the trust directory is actually a directory
unless File.directory?(path)
err = "trust directory #{path} isn't a directory"
raise Gem::Security::Exception, err
end
else
# trust directory doesn't exist, so create it with permissions
FileUtils.mkdir_p(path)
FileUtils.chmod(perms, path)
end
end