Method: Wright::Util::File.ln_sfn

Defined in:
lib/wright/util/file.rb

.ln_sfn(target, link_name) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Creates symlinks without descending into directories.

If the file denoted by link_name is a symlink to a directory, ln_sfn does not descend into it. Behaves similar to GNU ln(1) or OpenBSD ln(1) when using ln -sfn target link_name.

Parameters:

  • target (String)

    the link target

  • link_name (String)

    the link name



245
246
247
248
249
250
# File 'lib/wright/util/file.rb', line 245

def self.ln_sfn(target, link_name)
  if ::File.symlink?(link_name) && ::File.directory?(link_name)
    FileUtils.rm(link_name)
  end
  FileUtils.ln_sf(target, link_name)
end