copy_metadata(path) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# 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
Register or log in to add new notes.