class File
Public Class Methods
anything_exist?(path)
click to toggle source
# File lib/qdumpfs/util.rb, line 26 def self.anything_exist?(path) FileTest.exist?(path) or FileTest.symlink?(path) end
force_link(src, dest)
click to toggle source
# File lib/qdumpfs/util.rb, line 42 def self.force_link(src, dest) File.unlink(dest) if File.anything_exist?(dest) File.link(src, dest) end
force_symlink(src, dest)
click to toggle source
# File lib/qdumpfs/util.rb, line 34 def self.force_symlink(src, dest) begin File.unlink(dest) if File.anything_exist?(dest) File.symlink(src, dest) rescue end end
link(l, t)
click to toggle source
# File lib/qdumpfs/win32.rb, line 21 def File.link(l, t) result = CreateHardLinkA.call(t, l, 0) raise Errno::EACCES if result == 0 end
readable_file?(path)
click to toggle source
# File lib/qdumpfs/util.rb, line 47 def self.readable_file?(path) FileTest.file?(path) and FileTest.readable?(path) end
real_directory?(path)
click to toggle source
# File lib/qdumpfs/util.rb, line 30 def self.real_directory?(path) FileTest.directory?(path) and not FileTest.symlink?(path) end
real_file?(path)
click to toggle source
# File lib/qdumpfs/util.rb, line 22 def self.real_file?(path) FileTest.file?(path) and not FileTest.symlink?(path) end
split_all(path)
click to toggle source
# File lib/qdumpfs/util.rb, line 51 def self.split_all(path) parts = [] while true dirname, basename = File.split(path) break if path == dirname parts.unshift(basename) unless basename == "." path = dirname end return parts end
utime(a, m, dir)
click to toggle source
# File lib/qdumpfs/win32.rb, line 82 def File.utime(a, m, dir) File.utime_orig(a, m, dir) unless(File.directory?(dir)) atime = get_file_time(a.dup.utc) mtime = get_file_time(m.dup.utc) hDir = CreateFile.Call(dir.dup, GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) SetFileTime.call(hDir, 0, atime, mtime) CloseHandle.Call(hDir) return 0 end
Also aliased as: utime_orig