In Files

Included Modules

FileTestW

Calls the Unicode (wide) versions of the Windows API’s file functions.

It’s a subclass of the standard FileTest class that only overrides the methods when it’s run on a Windows system. Otherwise it functions as a normal FileTest class. File methods not re-implemented will behave as normal - trying to call the ASCII Windows API.

Public Instance Methods

directory?(file_name) click to toggle source
  • file_name — UTF-8 String
# File FileTestW.rb, line 46
        def directory?(file_name)
                file_name = WinEx::FileSystem::normalize_w(file_name)
                file_data = WinEx::FileSystem.get_file_data(file_name)
                return (file_data.file_attributes & WinEx::FILE_ATTRIBUTE_DIRECTORY == WinEx::FILE_ATTRIBUTE_DIRECTORY)
                # (!) Verify
        end
exist?(file_name) click to toggle source
  • file_name — UTF-8 String
# File FileTestW.rb, line 54
        def exist?(file_name)
                file_name = WinEx::FileSystem::normalize_w(file_name)
                return !WinEx::FileSystem.get_file_data(file_name).nil?
        end
Also aliased as: exists?
exists?(file_name) click to toggle source

Alias for exist?

size(file_name) click to toggle source
  • file_name — UTF-8 String
# File FileTestW.rb, line 61
        def size(file_name)
                # (?) Raise error if file not found?
                file_name = WinEx::FileSystem::normalize_w(file_name)
                return WinEx::FileSystem.get_file_data(file_name).file_size
        end
size?(file_name) click to toggle source
  • file_name — UTF-8 String
# File FileTestW.rb, line 68
        def size?(file_name)
                file_name = WinEx::FileSystem::normalize_w(file_name)
                attribs = WinEx::FileSystem.get_file_data(file_name)
                return nil if attribs.nil?
                return nil if attribs.file_size == 0
                return attribs.file_size
        end
zero?(file_name) click to toggle source
  • file_name — UTF-8 String
# File FileTestW.rb, line 77
        def zero?(file_name)
                file_name = WinEx::FileSystem::normalize_w(file_name)
                attribs = WinEx::FileSystem.get_file_data(file_name)
                return false if attribs.nil?
                return true if attribs.file_size == 0
                return false
        end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.