From 08704fd4ebf44324836958225e515b5609396d89 Mon Sep 17 00:00:00 2001 From: Richard Young Date: Tue, 16 Nov 2021 11:53:59 -0500 Subject: [PATCH] wip --- libarchive/__init__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libarchive/__init__.py b/libarchive/__init__.py index 985bac4..30b31cf 100644 --- a/libarchive/__init__.py +++ b/libarchive/__init__.py @@ -29,6 +29,8 @@ import sys import time import warnings +from ctypes import cdll, c_char_p + from libarchive import _libarchive from io import StringIO @@ -295,7 +297,7 @@ class EntryWriteStream(object): class Entry(object): '''An entry within an archive. Represents the header data and it's location within the archive.''' - def __init__(self, pathname=None, size=None, mtime=None, mode=None, hpos=None, encoding=ENCODING): + def __init__(self, pathname=None, size=None, mtime=None, mode=None, hpos=None, encoding=ENCODING, symlink=None): self.pathname = pathname self.size = size self.mtime = mtime @@ -303,6 +305,11 @@ class Entry(object): self.hpos = hpos self.encoding = encoding + if self.issym(): + self.symlink = symlink + else: + self.symlink = None + @property def header_position(self): return self.hpos @@ -328,6 +335,14 @@ class Entry(object): mode=mode, hpos=archive.header_position, ) + + symLinkPath = "" + + if entry.issym(): + libarchive.archive_entry_copy_symlink(e, symLinkPath) + + print(symLinkPath) + finally: _libarchive.archive_entry_free(e) return entry