fatfsparse.py: enable automatic detection of lfn

pull/9803/head
Martin Gaňo 2022-09-06 16:08:18 +02:00
rodzic 892437d829
commit 72acbeb921
4 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -55,9 +55,8 @@ def traverse_folder_tree(directory_bytes_: bytes,
try:
obj_: dict = Entry.ENTRY_FORMAT_SHORT_NAME.parse(
directory_bytes_[obj_address_: obj_address_ + FATDefaults.ENTRY_SIZE])
except (construct.core.ConstError, UnicodeDecodeError) as e:
if not args.long_name_support:
raise e
except (construct.core.ConstError, UnicodeDecodeError):
args.long_name_support = True
continue
if obj_['DIR_Attr'] == 0: # empty entry
@ -90,7 +89,7 @@ if __name__ == '__main__':
help='Path to the image that will be parsed and extracted.')
argument_parser.add_argument('--long-name-support',
action='store_true',
help='Set flag to enable long names support.')
help=argparse.SUPPRESS)
argument_parser.add_argument('--wear-leveling',
action='store_true',

Wyświetl plik

@ -320,7 +320,7 @@ class FatFSGen(unittest.TestCase):
f'{os.path.join(os.path.dirname(__file__), "..", "fatfsgen.py")}',
'testf', '--long_name_support'
], stderr=STDOUT)
run(['python', '../fatfsparse.py', 'fatfs_image.img', '--long-name-support'], stderr=STDOUT)
run(['python', '../fatfsparse.py', 'fatfs_image.img'], stderr=STDOUT)
assert compare_folders('testf', 'Espressif')

Wyświetl plik

@ -144,4 +144,4 @@ It is a reverse tool of (:component_file:`fatfsgen.py<fatfs/fatfsgen.py>`), i.e.
Usage::
./fatfsparse.py [-h] [--long-name-support] [--wear-leveling] fatfs_image.img
./fatfsparse.py [-h] [--wear-leveling] fatfs_image.img

Wyświetl plik

@ -144,4 +144,4 @@ FatFs 分区分析器
您可以使用::
./fatfsparse.py [-h] [--long-name-support] [--wear-leveling] fatfs_image.img
./fatfsparse.py [-h] [--wear-leveling] fatfs_image.img