Skip to content

Commit 2492276

Browse files
committed
Small update
1 parent 1259360 commit 2492276

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

pyfoxfile/pyfoxfile.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8385,7 +8385,7 @@ def PackFoxFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="au
83858385
def PackFoxFileFromInFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, saltkey=None, verbose=False, returnfp=False):
83868386
checkcompressfile = CheckCompressionSubType(infile, formatspecs, 0, True)
83878387
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
8388-
formatspecs = formatspecs[checkcompressfile]
8388+
ckformatspecs = formatspecs[checkcompressfile]
83898389
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
83908390
return PackFoxFileFromTarFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
83918391
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
@@ -8394,7 +8394,7 @@ def PackFoxFileFromInFile(infile, outfile, fmttype="auto", compression="auto", c
83948394
return PackFoxFileFromRarFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
83958395
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
83968396
return PackFoxFileFromSevenZipFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
8397-
elif(IsSingleDict(formatspecs) and checkcompressfile == formatspecs['format_magic']):
8397+
elif(checkcompressfile == ckformatspecs['format_magic']):
83988398
return RePackFoxFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, False, 0, 0, checksumtype, False, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
83998399
else:
84008400
return PackFoxFileFromBSDTarFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
@@ -8744,14 +8744,20 @@ def TarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile
87448744
return listarrayfiles
87458745

87468746

8747-
def BSDTarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
8748-
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True)
8749-
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
8750-
formatspecs = formatspecs[checkcompressfile]
8751-
fp = MkTempFile()
8752-
fp = PackArchiveFileFromBSDTarFile(infile, fp, "auto", True, None, compressionlistalt, "md5", [], formatspecs, None, False, True)
8753-
listarrayfiles = ArchiveFileToArray(fp, "auto", 0, seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, None, seektoend, returnfp)
8754-
return listarrayfiles
8747+
if(not libarchive_support):
8748+
def BSDTarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
8749+
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True):
8750+
return False
8751+
8752+
if(libarchive_support):
8753+
def BSDTarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
8754+
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True):
8755+
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
8756+
formatspecs = formatspecs[checkcompressfile]
8757+
fp = MkTempFile()
8758+
fp = PackArchiveFileFromBSDTarFile(infile, fp, "auto", True, None, compressionlistalt, "md5", [], formatspecs, None, False, True)
8759+
listarrayfiles = ArchiveFileToArray(fp, "auto", 0, seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, None, seektoend, returnfp)
8760+
return listarrayfiles
87558761

87568762

87578763
def ZipFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
@@ -10404,7 +10410,7 @@ def SevenZipFileListFile(infile, verbose=False, returnfp=False):
1040410410
def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0, skipchecksum=False, formatspecs=__file_format_multi_dict__, saltkey=None, seektoend=False, verbose=False, newstyle=False, returnfp=False):
1040510411
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True)
1040610412
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
10407-
formatspecs = formatspecs[checkcompressfile]
10413+
ckformatspecs = formatspecs[checkcompressfile]
1040810414
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
1040910415
return TarFileListFiles(infile, formatspecs, verbose, returnfp)
1041010416
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
@@ -10413,8 +10419,8 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1041310419
return RarFileListFiles(infile, verbose, returnfp)
1041410420
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
1041510421
return SevenZipFileListFiles(infile, verbose, returnfp)
10416-
elif(checkcompressfile == formatspecs['format_magic']):
10417-
return FoxFileListFiles(infile, fmttype, filestart, seekstart, seekend, skipchecksum, formatspecs, saltkey, seektoend, verbose, newstyle, returnfp)
10422+
elif(checkcompressfile == ckformatspecs['format_magic']):
10423+
return ArchiveFileListFiles(infile, fmttype, filestart, seekstart, seekend, skipchecksum, formatspecs, saltkey, seektoend, verbose, newstyle, returnfp)
1041810424
else:
1041910425
return BSDTarFileListFiles(infile, formatspecs, verbose, returnfp)
1042010426
return False

0 commit comments

Comments
 (0)