Sha256: 6dfa93f7ce55001426d228ebfb12b0bd0502d897b7e53f87495e3fc256d0227e

Contents?: true

Size: 425 Bytes

Versions: 17

Compression:

Stored size: 425 Bytes

Contents

require 'fileutils'

module FileUtils

  module_function

  LINKING_SUPPORTED = [true]

  # Attempt to do a normal file link, but fall back
  # to a copy if the link fails.
  #
  # CREDIT Jim Weirich

  def safe_ln(*args)
    unless LINKING_SUPPORTED[0]
      cp(*args)
    else
      begin
        ln(*args)
      rescue Errno::EOPNOTSUPP
        LINKING_SUPPORTED[0] = false
        cp(*args)
      end
    end
  end

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
facets-2.8.4 lib/more/facets/fileutils/safe_ln.rb
facets-2.8.3 lib/more/facets/fileutils/safe_ln.rb
facets-2.8.2 lib/more/facets/fileutils/safe_ln.rb
facets-2.8.1 lib/more/facets/fileutils/safe_ln.rb
facets-2.8.0 lib/more/facets/fileutils/safe_ln.rb
facets-2.7.0 lib/more/facets/fileutils/safe_ln.rb
facets-2.6.0 lib/lore/facets/fileutils/safe_ln.rb
facets-2.4.0 lib/facets/fileutils/safe_ln.rb
facets-2.4.1 lib/facets/fileutils/safe_ln.rb
facets-2.4.2 lib/lore/facets/fileutils/safe_ln.rb
facets-2.4.4 lib/lore/facets/fileutils/safe_ln.rb
facets-2.4.3 lib/lore/facets/fileutils/safe_ln.rb
facets-2.4.5 lib/lore/facets/fileutils/safe_ln.rb
facets-2.5.1 lib/lore/facets/fileutils/safe_ln.rb
facets-2.5.0 lib/lore/facets/fileutils/safe_ln.rb
facets-2.5.2 lib/lore/facets/fileutils/safe_ln.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/lore/facets/fileutils/safe_ln.rb