Sha256: 593c2fa909035126da449486635a608be19f69a12fbc58963bd426ef4cce0c47
Contents?: true
Size: 567 Bytes
Versions: 2
Compression:
Stored size: 567 Bytes
Contents
module Nyaa module Utils def self.safe_path(path) path = Dir.pwd if path.nil? || !File.writable?(path) FileUtils.mkdir_p path unless File.directory?(path) path end # Get gem's lib directory def self.gem_libdir paths = [ "#{File.dirname(File.expand_path($0))}/../lib/#{Nyaa::NAME}", "#{Gem.dir}/gems/#{Nyaa::NAME}-#{Nyaa::VERSION}/lib/#{Nyaa::NAME}" ] paths.each do |i| return i if File.readable?(i) end raise "Could not find 'lib' directory in: #{paths}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nyaa-1.0.5 | lib/nyaa/utils.rb |
nyaa-1.0.4 | lib/nyaa/utils.rb |