From 5bebd760a9c6df5979ccfc1408c6241cb67a9036 Mon Sep 17 00:00:00 2001 From: Matt Troutman Date: Wed, 2 Oct 2024 15:48:25 -0500 Subject: [PATCH] no message --- .fontfoldercleanup/font_folder_cleanup.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.fontfoldercleanup/font_folder_cleanup.py b/.fontfoldercleanup/font_folder_cleanup.py index 484d8d6..99126cf 100644 --- a/.fontfoldercleanup/font_folder_cleanup.py +++ b/.fontfoldercleanup/font_folder_cleanup.py @@ -263,22 +263,14 @@ def dont_use_dots_for_font_files(root_path=font_location): for root, dirs, files in os.walk(root_path): for file in files: file_path = os.path.join(root, file) - if file_path.endswith('.otf') or file_path.endswith('.ttf') or file_path.endswith('.ttc'): + if file_path.endswith('.otf') or file_path.endswith('.ttf') or file_path.endswith('.ttc') or file_path.endswith('.pdf'): new_file_path = None - - if file_path.startswith('.'): - new_file_path = file_path.lstrip('.') - - if file_path.startswith('_'): - new_file_path = file_path.lstrip('_') - - if file_path.startswith('.-'): - new_file_path = file_path.lstrip('.-') - if new_file_path != None: - os.rename(file_path, new_file_path) - print(f"Renamed file: {file_path} -> {new_file_path}") - - + for x in ['.', ' ', '-', '.-','--']: + if file_path.startswith(x): + new_file_path = file_path.lstrip(x) + os.rename(file_path, new_file_path) + print(f"Renamed file: {file_path} -> {new_file_path}") + new_file_path = None if __name__ == '__main__': remove_ds_store_files()