Feature #7106 ยป 0003-Add-support-for-File-lutimes-to-FileUtils.patch
lib/fileutils.rb | ||
---|---|---|
1181 | 1181 |
public |
1182 | 1182 | |
1183 | 1183 |
# |
1184 |
# Options: noop verbose |
|
1184 |
# Options: noop verbose mtime nocreate nofollow
|
|
1185 | 1185 |
# |
1186 | 1186 |
# Updates modification time (mtime) and access time (atime) of file(s) in |
1187 | 1187 |
# +list+. Files are created if they don't exist. |
... | ... | |
1201 | 1201 |
list.each do |path| |
1202 | 1202 |
created = nocreate |
1203 | 1203 |
begin |
1204 |
File.utime(t, t, path) |
|
1204 |
if File.symlink?(path) and options[:nofollow] |
|
1205 |
File.lutime(t, t, path) |
|
1206 |
else |
|
1207 |
File.utime(t, t, path) |
|
1208 |
end |
|
1205 | 1209 |
rescue Errno::ENOENT |
1206 | 1210 |
raise if created |
1207 | 1211 |
File.open(path, 'a') { |
... | ... | |
1213 | 1217 |
end |
1214 | 1218 |
end |
1215 | 1219 | |
1216 |
define_command('touch', :noop, :verbose, :mtime, :nocreate) |
|
1220 |
define_command('touch', :noop, :verbose, :mtime, :nocreate, :nofollow)
|
|
1217 | 1221 | |
1218 | 1222 |
private |
1219 | 1223 | |
... | ... | |
1442 | 1446 | |
1443 | 1447 |
def copy_metadata(path) |
1444 | 1448 |
st = lstat() |
1445 |
if !st.symlink? |
|
1449 |
if st.symlink? |
|
1450 |
begin |
|
1451 |
File.lutime st.atime, st.mtime, path |
|
1452 |
rescue NotImplementedError |
|
1453 |
end |
|
1454 |
else |
|
1446 | 1455 |
File.utime st.atime, st.mtime, path |
1447 | 1456 |
end |
1448 | 1457 |
begin |
1449 |
- |