method
copy_metadata
v2_5_5 -
Show latest stable
- Class:
FileUtils::Entry_
copy_metadata(path)public
No documentation available.
# File lib/fileutils.rb, line 1298
def copy_metadata(path)
st = lstat()
if !st.symlink?
File.utime st.atime, st.mtime, path
end
mode = st.mode
begin
if st.symlink?
begin
File.lchown st.uid, st.gid, path
rescue NotImplementedError
end
else
File.chown st.uid, st.gid, path
end
rescue Errno::EPERM, Errno::EACCES
# clear setuid/setgid
mode &= 01777
end
if st.symlink?
begin
File.lchmod mode, path
rescue NotImplementedError
end
else
File.chmod mode, path
end
end