fatfsgen.py: use lfn record when forbidden character detected in the file name

The file name is recorded as a LFN when it doesn't fit 8.3 pattern or if it contains characters prohibited in SFN
This commit is contained in:
Martin Gaňo
2022-09-14 12:26:25 +02:00
committed by BOT
parent 72de7c512e
commit 567f5f963c
2 changed files with 15 additions and 5 deletions

View File

@@ -4,12 +4,16 @@
import argparse
import binascii
import os
import re
import uuid
from datetime import datetime
from typing import List, Optional, Tuple
from construct import BitsInteger, BitStruct, Int16ul
# the regex pattern defines symbols that are allowed by long file names but not by short file names
INVALID_SFN_CHARS_PATTERN = re.compile(r'[.+,;=\[\]]')
FAT12_MAX_CLUSTERS: int = 4085
FAT16_MAX_CLUSTERS: int = 65525
RESERVED_CLUSTERS_COUNT: int = 2