In Files

WinEx::FileSystem

Collection of methods that call the Windows API’s file Unicode functions.

Public Class Methods

get_file_data(file_name) click to toggle source

Returns an WIN32_FIND_DATA object on success or nil on failure.

  • file_name — UTF-16 String NULL terminated
# File WinEx.rb, line 223
                def self.get_file_data(file_name)
                        # Declare API calls
                        findFirstFile                        = Win32API.new('Kernel32','FindFirstFileW',['P','P'], 'I')
                        findClose                            = Win32API.new('Kernel32','FindClose',['I'], 'I')
                        # Reserve memory for the WIN32_FIND_DATA struct
                        win32_find_data = WinEx::Struct::WIN32_FIND_DATA.new()
                        # Make the calls - remember to close
                        handle = findFirstFile.call(file_name, win32_find_data)
                        bool = findClose.call(handle)
                        # Return the data
                        return nil if (handle == WinEx::INVALID_HANDLE_VALUE)
                        return win32_find_data
                end
normalize_file_name(file_name) click to toggle source

Returns file_name with all forward slashes converted to backward slashes.

  • file_name — UTF-8 String
# File WinEx.rb, line 239
                def self.normalize_file_name(file_name)
                        return file_name.gsub(%[/], '\\')
                end
normalize_w(file_name) click to toggle source

Returns file_name normalized and in UTF-16 NULL terminated.

  • file_name — UTF-8 String
# File WinEx.rb, line 245
                def self.normalize_w(file_name)
                        file_name = self.normalize_file_name(file_name)
                        return UnicodeEx::UTF8::to_w(file_name) + "\000\000"
                end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.