* lib/fileutils.rb (FileUtils#uptodate?): use mtime for comparison.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2003-02-10 10:48:38 +00:00
parent ab24be4e98
commit dc502aea7e
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Mon Feb 10 19:54:30 2003 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (FileUtils#uptodate?): use mtime for
comparison.
Mon Feb 10 10:14:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Feb 10 10:14:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_to_a): return value should be an Array if the * array.c (rb_ary_to_a): return value should be an Array if the

View File

@ -101,13 +101,13 @@ module FileUtils
# Returns true if +newer+ is newer than all +old_list+. # Returns true if +newer+ is newer than all +old_list+.
# Non-existent files are older than any file. # Non-existent files are older than any file.
# #
# FileUtils.uptodate? 'hello.o', %w(hello.c hello.h) or system 'make' # FileUtils.uptodate? 'hello.o', %w(hello.c hello.h) or system 'make hello.o'
# #
def uptodate?( new, old_list, *options ) def uptodate?( new, old_list, *options )
raise ArgumentError, 'uptodate? does not accept any option' unless options.empty? raise ArgumentError, 'uptodate? does not accept any option' unless options.empty?
return false unless FileTest.exist? new return false unless FileTest.exist? new
new_time = File.ctime(new) new_time = File.mtime(new)
old_list.each do |old| old_list.each do |old|
if FileTest.exist? old if FileTest.exist? old
return false unless new_time > File.mtime(old) return false unless new_time > File.mtime(old)