修复了.png等文件的大小写问题

dev
Dawn_Ocean 2023-10-22 20:08:09 +08:00
parent 83f79474b3
commit 6e3b1d7ddc
1 changed files with 2 additions and 1 deletions

View File

@ -29,6 +29,7 @@ def convert_all(path = os.path.abspath('.')):
def convert_img(path = os.path.abspath('.')): def convert_img(path = os.path.abspath('.')):
files = os.listdir(path) files = os.listdir(path)
for file in files: for file in files:
file = file.lower() # 排除 .PNG 等带来的问题
if file.endswith('.pdf'): if file.endswith('.pdf'):
result = pdf2img(path, file) result = pdf2img(path, file)
if result: # 1 -> Error if result: # 1 -> Error
@ -52,7 +53,7 @@ def gen_filelist(path = os.path.abspath('.')):
png_count = 0 png_count = 0
dir_file_copy = copy(dir_file) dir_file_copy = copy(dir_file)
for file in dir_file_copy: for file in dir_file_copy:
if ".png" in file: if ".png" in file.lower():
png_count += 1 png_count += 1
else: else:
dir_file.remove(file) dir_file.remove(file)