Skip to content

Commit 6d557ca

Browse files
author
Kazuki Suzuki Przyborowski
committed
Small update
1 parent d7767ea commit 6d557ca

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

archivefile.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ len = 11
1010
hex = 4172636869766546696c65
1111
ver = 001
1212
name = ArchiveFile
13-
lower = archivefile
1413
magic = ArchiveFile
1514
delimiter = \x00
1615
extension = .arc

archivefile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def handler(signum, frame):
7373
__project__ = pyarchivefile.__project__
7474
__program_name__ = pyarchivefile.__program_name__
7575
__file_format_name__ = pyarchivefile.__file_format_name__
76-
__file_format_lower__ = pyarchivefile.__file_format_lower__
7776
__file_format_magic__ = pyarchivefile.__file_format_magic__
7877
__file_format_len__ = pyarchivefile.__file_format_len__
7978
__file_format_hex__ = pyarchivefile.__file_format_hex__
@@ -147,7 +146,6 @@ def handler(signum, frame):
147146
getargs = argparser.parse_args()
148147

149148
fname = getargs.format
150-
fnamelower = fname.lower()
151149
if(getargs.format=="auto"):
152150
fnamedict = __file_format_multi_dict__
153151
__file_format_default__ = getargs.format
@@ -159,7 +157,7 @@ def handler(signum, frame):
159157
fnamesty = __use_new_style__
160158
fnamelst = __use_advanced_list__
161159
fnameino = __use_alt_inode__
162-
fnamedict = {'format_name': fname, 'format_magic': fnamemagic, 'format_lower': fnamelower, 'format_len': fnamelen, 'format_hex': fnamehex,
160+
fnamedict = {'format_name': fname, 'format_magic': fnamemagic, 'format_len': fnamelen, 'format_hex': fnamehex,
163161
'format_delimiter': getargs.delimiter, 'format_ver': getargs.formatver, 'new_style': fnamesty, 'use_advanced_list': fnamelst, 'use_alt_inode': fnameino}
164162

165163
# Determine the primary action based on user input

pyarchivefile.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,15 @@ def decode_unicode_escape(value):
304304
# Loop through all sections
305305
for section in config.sections():
306306
required_keys = [
307-
"len", "hex", "ver", "name", "lower",
307+
"len", "hex", "ver", "name",
308308
"magic", "delimiter", "extension",
309309
"newstyle", "advancedlist", "altinode"
310310
]
311-
if all(key in config[section] for key in required_keys):
311+
if section != "config" and all(key in config[section] for key in required_keys):
312312
delim = decode_unicode_escape(config.get(section, 'delimiter'))
313313
if(not is_only_nonprintable(delim)):
314314
delim = "\x00" * len("\x00")
315-
__file_format_multi_dict__.update( { decode_unicode_escape(config.get(section, 'magic')): {'format_name': decode_unicode_escape(config.get(section, 'name')), 'format_magic': decode_unicode_escape(config.get(section, 'magic')), 'format_lower': decode_unicode_escape(config.get(section, 'lower')), 'format_len': config.getint(section, 'len'), 'format_hex': config.get(section, 'hex'), 'format_delimiter': delim, 'format_ver': config.get(section, 'ver'), 'new_style': config.getboolean(section, 'newstyle'), 'use_advanced_list': config.getboolean(section, 'advancedlist'), 'use_alt_inode': config.getboolean(section, 'altinode'), 'format_extension': decode_unicode_escape(config.get(section, 'extension')) } } )
315+
__file_format_multi_dict__.update( { decode_unicode_escape(config.get(section, 'magic')): {'format_name': decode_unicode_escape(config.get(section, 'name')), 'format_magic': decode_unicode_escape(config.get(section, 'magic')), 'format_len': config.getint(section, 'len'), 'format_hex': config.get(section, 'hex'), 'format_delimiter': delim, 'format_ver': config.get(section, 'ver'), 'new_style': config.getboolean(section, 'newstyle'), 'use_advanced_list': config.getboolean(section, 'advancedlist'), 'use_alt_inode': config.getboolean(section, 'altinode'), 'format_extension': decode_unicode_escape(config.get(section, 'extension')) } } )
316316
if not __file_format_multi_dict__ and not __include_defaults__:
317317
__include_defaults__ = True
318318
elif __use_ini_file__ and not os.path.exists(__config_file__):
@@ -322,11 +322,10 @@ def decode_unicode_escape(value):
322322
__include_defaults__ = True
323323
if(__include_defaults__):
324324
if("ArchiveFile" not in __file_format_multi_dict__):
325-
__file_format_multi_dict__.update( { 'ArchiveFile': {'format_name': "ArchiveFile", 'format_magic': "ArchiveFile", 'format_lower': "archivefile", 'format_len': 11, 'format_hex': "4172636869766546696c65", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".arc" } } )
325+
__file_format_multi_dict__.update( { 'ArchiveFile': {'format_name': "ArchiveFile", 'format_magic': "ArchiveFile", 'format_len': 11, 'format_hex': "4172636869766546696c65", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".arc" } } )
326326
if(__file_format_default__ not in __file_format_multi_dict__):
327327
__file_format_default__ = next(iter(__file_format_multi_dict__))
328328
__file_format_name__ = __file_format_multi_dict__[__file_format_default__]['format_name']
329-
__file_format_lower__ = __file_format_multi_dict__[__file_format_default__]['format_lower']
330329
__file_format_magic__ = __file_format_multi_dict__[__file_format_default__]['format_magic']
331330
__file_format_len__ = __file_format_multi_dict__[__file_format_default__]['format_len']
332331
__file_format_hex__ = __file_format_multi_dict__[__file_format_default__]['format_hex']

0 commit comments

Comments
 (0)