I’m familiar with
File.chmod 0777 filename
however, anybody know the equivalent to “chmod u+r filename” from the
command line–but in ruby?
Thanks!
-r
I’m familiar with
File.chmod 0777 filename
however, anybody know the equivalent to “chmod u+r filename” from the
command line–but in ruby?
Thanks!
-r
On Oct 9, 2009, at 3:29 PM, Roger P. wrote:
I’m familiar with
File.chmod 0777 filenamehowever, anybody know the equivalent to “chmod u+r filename” from the
command line–but in ruby?
Thanks!
-rPosted via http://www.ruby-forum.com/.
File.class_eval do
def self.addmod(flags, filename)
themode=stat(filename).mode | flags
chmod(themode, filename)
end
end
Although there’s no error checking and the return value could probably
be something better (like themode).
So after defining that, your ‘u+r’ would be:
File.addmod(0200, ‘filename’)
-Rob
File.class_eval do
def self.addmod(flags, filename)
themode=stat(filename).mode | flags
chmod(themode, filename)
end
endAlthough there’s no error checking and the return value could probably
be something better (like themode).So after defining that, your ‘u+r’ would be:
File.addmod(0200, ‘filename’)
Much thanks.
-r
Roger P. wrote:
the equivalent to “chmod u+r filename” […] in ruby?
I filed a feature request for symbolic mode (‘u+r’) support
in FileUtils::chmod() and FileUtils::chmod_R() methods here:
http://redmine.ruby-lang.org/issues/show/2190
Cheers.
I filed a feature request for symbolic mode (‘u+r’) support
in FileUtils::chmod() and FileUtils::chmod_R() methods here:http://redmine.ruby-lang.org/issues/show/2190
Cheers.
Thanks for doing that.
-r
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs