INNER CODE UNIT · Python
Add
DaemonEngine/Daemon · external_deps/cygtar.py:189
def Add(self, filepath, prefix=None):
"""Add path filepath to the archive which may be Native style.
Add files individually recursing on directories. For POSIX we use
tarfile.addfile directly on symlinks and hardlinks. For files, we
must check if they are duplicates which we convert to hardlinks
or Cygwin style symlinks which we convert form a file to a symlink
in the tarfile. All other files are added as a standard file.
"""
# At this point tarinfo.name will contain a POSIX style path regardless
# of the original filepath.
tarinfo = self.tar.gettarinfo(filepath)
if prefix:
tarinfo.name = posixpath.join(prefix, tarinfo.name)
if sys.platform == 'win32':
# On win32 os.stat() always claims that files are world writable