Skip to content

Commit ee1ac6d

Browse files
author
Kazuki Suzuki Przyborowski
committed
Small bug fix
1 parent 8e247d2 commit ee1ac6d

13 files changed

Lines changed: 32 additions & 32 deletions
496 KB
Binary file not shown.

altcatfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: altcatfile.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: altcatfile.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes

catfile.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; $FileInfo: catfile.ini - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
1+
; $FileInfo: catfile.ini - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
22

33
[config]
44
default = CatFile

catfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: catfile.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: catfile.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes

checksum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: checksum.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: checksum.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes

compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: compression.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: compression.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes

mkcatfilebundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: mkbundle.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: mkbundle.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
import os

neocatfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: neocatfile.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: neocatfile.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes

phpcatfile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1313
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1414
15-
$FileInfo: phpcatfile.php - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
15+
$FileInfo: phpcatfile.php - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1616
*/
1717

1818
date_default_timezone_set('UTC');

pycatfile.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17-
$FileInfo: pycatfile.py - Last Update: 1/24/2025 Ver. 0.17.0 RC 1 - Author: cooldude2k $
17+
$FileInfo: pycatfile.py - Last Update: 1/24/2025 Ver. 0.17.2 RC 1 - Author: cooldude2k $
1818
'''
1919

2020
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
@@ -333,7 +333,7 @@ def decode_unicode_escape(value):
333333
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
334334
__project__ = __program_name__
335335
__project_url__ = "https://github.com/GameMaker2k/PyCatFile"
336-
__version_info__ = (0, 17, 0, "RC 1", 1)
336+
__version_info__ = (0, 17, 2, "RC 1", 1)
337337
__version_date_info__ = (2025, 1, 24, "RC 1", 1)
338338
__version_date__ = str(__version_date_info__[0]) + "." + str(
339339
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
@@ -1741,7 +1741,7 @@ def GetDataFromArrayAlt(structure, path, default=None):
17411741
def GetHeaderChecksum(inlist=[], checksumtype="crc32", encodedata=True, formatspecs=__file_format_dict__):
17421742
fileheader = AppendNullBytes(inlist, formatspecs['format_delimiter']) if isinstance(
17431743
inlist, list) else AppendNullByte(inlist, formatspecs['format_delimiter'])
1744-
if encodedata:
1744+
if encodedata and hasattr(fileheader, "encode"):
17451745
fileheader = fileheader.encode('UTF-8')
17461746
checksum_methods = {
17471747
"crc16": lambda data: format(crc16(data) & 0xffff, '04x').lower(),
@@ -1764,7 +1764,7 @@ def GetHeaderChecksum(inlist=[], checksumtype="crc32", encodedata=True, formatsp
17641764

17651765

17661766
def GetFileChecksum(instr, checksumtype="crc32", encodedata=True, formatspecs=__file_format_dict__):
1767-
if encodedata:
1767+
if encodedata and hasattr(instr, "encode"):
17681768
instr = instr.encode('UTF-8')
17691769
checksum_methods = {
17701770
"crc16": lambda data: format(crc16(data) & 0xffff, '04x').lower(),
@@ -3028,12 +3028,12 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
30283028
def AppendNullByte(indata, delimiter=__file_format_dict__['format_delimiter']):
30293029
if(isinstance(indata, int)):
30303030
indata = str(indata)
3031-
outdata = indata + delimiter
3031+
outdata = indata.encode("UTF-8") + delimiter.encode("UTF-8")
30323032
return outdata
30333033

30343034

30353035
def AppendNullBytes(indata=[], delimiter=__file_format_dict__['format_delimiter']):
3036-
outdata = ""
3036+
outdata = "".encode("UTF-8")
30373037
inum = 0
30383038
il = len(indata)
30393039
while(inum < il):
@@ -3087,7 +3087,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], checksumtype="crc32"
30873087
catheaersize = format(int(len(fnumfilesa) - len(formatspecs['format_delimiter'])), 'x').lower()
30883088
catheaersizestr = AppendNullByte(catheaersize, formatspecs['format_delimiter'])
30893089
try:
3090-
fp.write(fnumfilesa.encode('UTF-8'))
3090+
fp.write(fnumfilesa)
30913091
except OSError:
30923092
return False
30933093
try:
@@ -3242,7 +3242,7 @@ def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], filecontent="",
32423242
catfileoutstr = catfileoutstr + \
32433243
AppendNullBytes([catfileheadercshex, catfilecontentcshex],
32443244
formatspecs['format_delimiter'])
3245-
catfileoutstrecd = catfileoutstr.encode('UTF-8')
3245+
catfileoutstrecd = catfileoutstr
32463246
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
32473247
catfileout = catfileoutstrecd + filecontent + nullstrecd
32483248
try:
@@ -3551,7 +3551,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
35513551
if(numfiles > 0):
35523552
try:
35533553
fp.write(AppendNullBytes(
3554-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
3554+
["0", "0"], formatspecs['format_delimiter']))
35553555
except OSError:
35563556
return False
35573557
fp.seek(0, 0)
@@ -3616,7 +3616,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
36163616
if(numfiles > 0):
36173617
try:
36183618
fp.write(AppendNullBytes(
3619-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
3619+
["0", "0"], formatspecs['format_delimiter']))
36203620
except OSError:
36213621
return False
36223622
return fp
@@ -4927,7 +4927,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
49274927
if(numfiles > 0):
49284928
try:
49294929
fp.write(AppendNullBytes(
4930-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
4930+
["0", "0"], formatspecs['format_delimiter']))
49314931
except OSError:
49324932
return False
49334933
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
@@ -5222,7 +5222,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
52225222
if(numfiles > 0):
52235223
try:
52245224
fp.write(AppendNullBytes(
5225-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
5225+
["0", "0"], formatspecs['format_delimiter']))
52265226
except OSError:
52275227
return False
52285228
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
@@ -5508,7 +5508,7 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
55085508
if(numfiles > 0):
55095509
try:
55105510
fp.write(AppendNullBytes(
5511-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
5511+
["0", "0"], formatspecs['format_delimiter']))
55125512
except OSError:
55135513
return False
55145514
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
@@ -5824,7 +5824,7 @@ def PackArchiveFileFromRarFile(infile, outfile, fmttype="auto", compression="aut
58245824
if(numfiles > 0):
58255825
try:
58265826
fp.write(AppendNullBytes(
5827-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
5827+
["0", "0"], formatspecs['format_delimiter']))
58285828
except OSError:
58295829
return False
58305830
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
@@ -6073,7 +6073,7 @@ def PackArchiveFileFromSevenZipFile(infile, outfile, fmttype="auto", compression
60736073
if(numfiles > 0):
60746074
try:
60756075
fp.write(AppendNullBytes(
6076-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
6076+
["0", "0"], formatspecs['format_delimiter']))
60776077
except OSError:
60786078
return False
60796079
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
@@ -7794,7 +7794,7 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, fmttype=__file_format_defau
77947794
catfileoutstr = catfileoutstr + \
77957795
AppendNullBytes([catfileheadercshex, catfilecontentcshex],
77967796
formatspecs['format_delimiter'])
7797-
catfileoutstrecd = catfileoutstr.encode('UTF-8')
7797+
catfileoutstrecd = catfileoutstr
77987798
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
77997799
catfcontentstart = fheadtell
78007800
fheadtell += len(catfileoutstr) + 1
@@ -8080,7 +8080,7 @@ def TarFileToArrayAlt(infile, fmttype=__file_format_default__, listonly=False, c
80808080
catfileoutstr = catfileoutstr + \
80818081
AppendNullBytes([catfileheadercshex, catfilecontentcshex],
80828082
formatspecs['format_delimiter'])
8083-
catfileoutstrecd = catfileoutstr.encode('UTF-8')
8083+
catfileoutstrecd = catfileoutstr
80848084
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
80858085
catfcontentstart = fheadtell
80868086
fheadtell += len(catfileoutstr) + 1
@@ -8361,7 +8361,7 @@ def ZipFileToArrayAlt(infile, fmttype=__file_format_default__, listonly=False, c
83618361
catfileoutstr = catfileoutstr + \
83628362
AppendNullBytes([catfileheadercshex, catfilecontentcshex],
83638363
formatspecs['format_delimiter'])
8364-
catfileoutstrecd = catfileoutstr.encode('UTF-8')
8364+
catfileoutstrecd = catfileoutstr
83658365
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
83668366
catfcontentstart = fheadtell
83678367
fheadtell += len(catfileoutstr) + 1
@@ -8653,7 +8653,7 @@ def RarFileToArrayAlt(infile, fmttype=__file_format_default__, listonly=False, c
86538653
AppendNullBytes(
86548654
[catfileheadercshex, catfilecontentcshex], formatspecs['format_delimiter'])
86558655
catheaderdata = catoutlist
8656-
catfileoutstrecd = catfileoutstr.encode('UTF-8')
8656+
catfileoutstrecd = catfileoutstr
86578657
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
86588658
catfcontentstart = fheadtell
86598659
fheadtell += len(catfileoutstr) + 1
@@ -8890,7 +8890,7 @@ def SevenZipFileToArrayAlt(infile, fmttype=__file_format_default__, listonly=Fal
88908890
catfileoutstr = catfileoutstr + \
88918891
AppendNullBytes(
88928892
[catfileheadercshex, catfilecontentcshex], formatspecs['format_delimiter'])
8893-
catfileoutstrecd = catfileoutstr.encode('UTF-8')
8893+
catfileoutstrecd = catfileoutstr
88948894
nullstrecd = formatspecs['format_delimiter'].encode('UTF-8')
88958895
catfcontentstart = fheadtell
88968896
fheadtell += len(catfileoutstr) + 1
@@ -9234,7 +9234,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
92349234
if(lcfx > 0):
92359235
try:
92369236
fp.write(AppendNullBytes(
9237-
["0", "0"], formatspecs['format_delimiter']).encode("UTF-8"))
9237+
["0", "0"], formatspecs['format_delimiter']))
92389238
except OSError:
92399239
return False
92409240
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):

0 commit comments

Comments
 (0)