diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-29 03:51:13 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-29 03:51:13 +0000 |
commit | 17a4a9b99327e44e2ddf22c060a2c6802441f91e (patch) | |
tree | 3ba28d12c6d8f87f17aa0efbc4b1589128919174 | |
parent | cce5fe1ae5ac2e272d7d0e841100f0644fe4fa51 (diff) | |
download | ruby-17a4a9b99327e44e2ddf22c060a2c6802441f91e.tar.gz |
* lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
rescue LoadError on 'etc'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/fileutils.rb | 60 |
2 files changed, 29 insertions, 36 deletions
@@ -1,3 +1,8 @@ +Tue Apr 29 12:50:02 2014 Tanaka Akira <akr@fsij.org> + + * lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in + rescue LoadError on 'etc'. + Tue Apr 29 10:21:38 2014 Kazuki Tsujimoto <kazuki@callcc.net> * parse.y (symbols_i): like r45492, call rb_gc_resurrect(). diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 6d1f2764fa..4efc6184c2 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -1097,46 +1097,34 @@ module FileUtils begin require 'etc' + rescue LoadError # rescue LoadError for miniruby + end - def fu_get_uid(user) #:nodoc: - return nil unless user - case user - when Integer - user - when /\A\d+\z/ - user.to_i - else - Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil - end - end - private_module_function :fu_get_uid - - def fu_get_gid(group) #:nodoc: - return nil unless group - case group - when Integer - group - when /\A\d+\z/ - group.to_i - else - Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil - end - end - private_module_function :fu_get_gid - - rescue LoadError - # need Win32 support??? - - def fu_get_uid(user) #:nodoc: - user # FIXME + def fu_get_uid(user) #:nodoc: + return nil unless user + case user + when Integer + user + when /\A\d+\z/ + user.to_i + else + Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil end - private_module_function :fu_get_uid - - def fu_get_gid(group) #:nodoc: - group # FIXME + end + private_module_function :fu_get_uid + + def fu_get_gid(group) #:nodoc: + return nil unless group + case group + when Integer + group + when /\A\d+\z/ + group.to_i + else + Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil end - private_module_function :fu_get_gid end + private_module_function :fu_get_gid # # Options: noop verbose |