lib/file.rb in wixgem-0.57.0 vs lib/file.rb in wixgem-0.58.0

- old
+ new

@@ -1,12 +1,14 @@ -require 'fiddle' +require 'win32ole' class File FILE_ATTRIBUTE_READONLY="0x1".hex def self.read_only?(path) raise "'#{path}' does not exist" unless(File.exists?(path)) - kernel32 = Fiddle::Handle.new("kernel32") - get_file_attributes = Fiddle::Function.new(kernel32['GetFileAttributesA'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_LONG) - - return ((get_file_attributes.call(path) & FILE_ATTRIBUTE_READONLY) == 1) ? true : false; + + fso = WIN32OLE.new('Scripting.FileSystemObject') + raise 'Failed to create Scripting.FileSystemObject' if(fso.nil?) + fo = fso.GetFile(path) + + return (fo.Attributes & 1) ? true : false; end end \ No newline at end of file