Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Package#create_symlink
create_symlink(old_name, new_name)
lib/rubygems/package.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/package.rb, line 937
def create_symlink(old_name, new_name)
File.symlink(old_name, new_name)
rescue Errno::EACCES, TypeError
from = File.expand_path(old_name, File.dirname(new_name))
FileUtils.cp_r(from, new_name)
end
Create a symlink and fallback to copy the file or directory on Windows, where symlink creation needs special privileges in form of the Developer Mode. JRuby on Windows raises TypeError from the wincode path-conversion helper when it cannot create the symlink, so fall back to copy in that case too.