Sha256: 2bd0cce82599eff85c31183a20f25fb1625efc135910eb128b0f256196bda215

Contents?: true

Size: 430 Bytes

Versions: 5

Compression:

Stored size: 430 Bytes

Contents

require 'fiddle'

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;
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wixgem-0.57.0 lib/file.rb
wixgem-0.56.0 lib/file.rb
wixgem-0.55.0 lib/file.rb
wixgem-0.54.0 lib/file.rb
wixgem-0.53.0 lib/file.rb