Sha256: d6b6cf8d374d9425799d153e769e9a1ae03c70e7de7b138283840639c82313ca

Contents?: true

Size: 410 Bytes

Versions: 1

Compression:

Stored size: 410 Bytes

Contents

require 'fiddle'

class File
  FILE_ATTRIBUTE_READONLY="0x1".hex		
  def self.read_only?(path)
    return false 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;
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wixgem-0.52.0 lib/file.rb