Sha256: 6c3e4f176c22f9d9349be51b36643c5a51ea223a5d70aafc9ede6095f2d4619a

Contents?: true

Size: 417 Bytes

Versions: 2

Compression:

Stored size: 417 Bytes

Contents


require 'pathname'

module FileUtils
  def self.touch_p(file)
    dir = File.dirname(file)
    File.exist?(dir) or FileUtils.mkdir_p(dir)
    touch(file)
  end

  def self.ln_sr(from, to)
    from = Pathname.new(from)
    to_dir = File.dirname(to)
    to_file = File.basename(to)
    relpath = from.relative_path_from(File.dirname(to))
    Dir.chdir(to_dir) { FileUtils.ln_s(relpath, File.basename(to)) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prick-0.4.0 lib/ext/fileutils.rb
prick-0.3.0 lib/ext/fileutils.rb