Correct handling order of runtime options, followup #44

This commit is contained in:
extremecoders-re
2022-05-13 11:01:54 +03:00
committed by GitHub
parent d68ef84279
commit 4dc147a379

View File

@@ -275,12 +275,6 @@ class PyInstArchive:
os.chdir(extractionDir) os.chdir(extractionDir)
for entry in self.tocList: 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) self.fPtr.seek(entry.position, os.SEEK_SET)
data = self.fPtr.read(entry.cmprsdDataSize) data = self.fPtr.read(entry.cmprsdDataSize)
@@ -290,6 +284,18 @@ class PyInstArchive:
# Comment out the assertion in such a case # Comment out the assertion in such a case
assert len(data) == entry.uncmprsdDataSize # Sanity Check 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': if entry.typeCmprsData == b's':
# s -> ARCHIVE_ITEM_PYSOURCE # s -> ARCHIVE_ITEM_PYSOURCE
# Entry point are expected to be python scripts # 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 # packages and modules are pyc files with their header's intact
self._writeRawData(entry.name + '.pyc', data) 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: else:
self._writeRawData(entry.name, data) self._writeRawData(entry.name, data)