(unknown)

I'm trying to use win32/file to set permission on a file, but I can't seem
to get it working. Here's what I've tried

require "win32/file"
File.set_permissions("C:\\foo.txt", {"Domain\\username" => 2032127})

and I get this error

:/ruby/lib/ruby/gems/1.8/gems/win32-file-0.5.5/lib/win32/file.rb:212:in
`set_permissions': The access control list (ACL) structure is invalid.
(ArgumentError)

I can read permissions I just can't set them.

Hi,

Dave Smith wrote:

I'm trying to use win32/file to set permission on a file, but I can't
seem
to get it working. Here's what I've tried

require "win32/file"
File.set_permissions("C:\\foo.txt", {"Domain\\username" => 2032127})

and I get this error

:/ruby/lib/ruby/gems/1.8/gems/win32-file-0.5.5/lib/win32/file.rb:212:in
`set_permissions': The access control list (ACL) structure is invalid.
(ArgumentError)

In the current version, it means the given account do not exist.
The misleading message must be modified.

Inserting the following line at file.rb #158 will solve this problem.

if sid.strip == ""
  raise ArgumentError, 'Account does not exist'
end

I can read permissions I just can't set them.

Try this:

perm = File.get_permissions("C:\\foo.txt")
p perm
File.set_permissions("C:\\foo.txt",perm)

Regards,
Park Heesob

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.