diff --git a/pyinstxtractor.py b/pyinstxtractor.py index 8c1c865..9672019 100644 --- a/pyinstxtractor.py +++ b/pyinstxtractor.py @@ -275,12 +275,6 @@ class PyInstArchive: os.chdir(extractionDir) for entry in self.tocList: - basePath = os.path.dirname(entry.name) - if basePath != '': - # Check if path exists, create if not - if not os.path.exists(basePath): - os.makedirs(basePath) - self.fPtr.seek(entry.position, os.SEEK_SET) data = self.fPtr.read(entry.cmprsdDataSize) @@ -290,6 +284,18 @@ class PyInstArchive: # Comment out the assertion in such a case assert len(data) == entry.uncmprsdDataSize # Sanity Check + if entry.typeCmprsData == b'd' or entry.typeCmprsData == b'o': + # d -> ARCHIVE_ITEM_DEPENDENCY + # o -> ARCHIVE_ITEM_RUNTIME_OPTION + # These are runtime options, not files + continue + + basePath = os.path.dirname(entry.name) + if basePath != '': + # Check if path exists, create if not + if not os.path.exists(basePath): + os.makedirs(basePath) + if entry.typeCmprsData == b's': # s -> ARCHIVE_ITEM_PYSOURCE # Entry point are expected to be python scripts @@ -302,12 +308,6 @@ class PyInstArchive: # packages and modules are pyc files with their header's intact self._writeRawData(entry.name + '.pyc', data) - elif entry.typeCmprsData == b'd' or entry.typeCmprsData == b'o': - # d -> ARCHIVE_ITEM_DEPENDENCY - # o -> ARCHIVE_ITEM_RUNTIME_OPTION - # These are runtime options, not files - pass - else: self._writeRawData(entry.name, data)