From: Dave Smith Date: 2008-04-29T02:18:29+09:00 Subject: win32-file set_permissions ------=_Part_6331_14060936.1209403108150 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, Apr 27, 2008 at 8:10 PM, Heesob Park wrote: > 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 Thanks for your help. It looks like some strange things are happening. When I do the above where I get, then set the permssions on my local drive it works fine. When I do it on a mapped drive I get the account not found error after inserting the code above. However, if I try to add a domain account permissions to the file then it doesn't give an error, but it doesn't add the permissions either. > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_6331_14060936.1209403108150--