Feature #7106 » 0003-Add-support-for-File-lutimes-to-FileUtils.patch
lib/fileutils.rb | ||
---|---|---|
public
|
||
#
|
||
# Options: noop verbose
|
||
# Options: noop verbose mtime nocreate nofollow
|
||
#
|
||
# Updates modification time (mtime) and access time (atime) of file(s) in
|
||
# +list+. Files are created if they don't exist.
|
||
... | ... | |
list.each do |path|
|
||
created = nocreate
|
||
begin
|
||
File.utime(t, t, path)
|
||
if File.symlink?(path) and options[:nofollow]
|
||
File.lutime(t, t, path)
|
||
else
|
||
File.utime(t, t, path)
|
||
end
|
||
rescue Errno::ENOENT
|
||
raise if created
|
||
File.open(path, 'a') {
|
||
... | ... | |
end
|
||
end
|
||
define_command('touch', :noop, :verbose, :mtime, :nocreate)
|
||
define_command('touch', :noop, :verbose, :mtime, :nocreate, :nofollow)
|
||
private
|
||
... | ... | |
def copy_metadata(path)
|
||
st = lstat()
|
||
if !st.symlink?
|
||
if st.symlink?
|
||
begin
|
||
File.lutime st.atime, st.mtime, path
|
||
rescue NotImplementedError
|
||
end
|
||
else
|
||
File.utime st.atime, st.mtime, path
|
||
end
|
||
begin
|