no message

This commit is contained in:
Matt Troutman 2024-10-02 16:08:00 -05:00
parent 747b93412d
commit 1f18110229
No known key found for this signature in database

View file

@ -259,17 +259,21 @@ def lowercase_and_dash_file_names(root_path=font_location):
else: else:
print(f"File not found: {file_path}") print(f"File not found: {file_path}")
def dont_use_dots_for_font_files(root_path=font_location): def dont_use_dots_for_font_files(root_path=font_location):
for root, dirs, files in os.walk(root_path): for root, dirs, files in os.walk(root_path):
for file in files: for file in files:
file_path = os.path.join(root, file) file_path = os.path.join(root, file)
if file_path.endswith('.otf') or file_path.endswith('.ttf') or file_path.endswith('.ttc') or file_path.endswith('.pdf'): if file_path.endswith('.otf') or file_path.endswith('.ttf') or file_path.endswith('.ttc') or file_path.endswith('.pdf'):
new_file_path = None new_file_path = None
for x in ['.', ' ', '-', '.-','--']: for x in ['.','_', ' ', '-', '.-','--']:
if file.startswith(x): if file.startswith(x):
new_file_path = os.path.join(root, file.lstrip(x)) new_file_path = os.path.join(root, file.lstrip(x))
os.rename(file_path, new_file_path) if not os.path.exists(new_file_path):
print(f"Renamed file: {file_path} -> {new_file_path}") os.rename(file_path, new_file_path)
print(f"Renamed file: {file_path} -> {new_file_path}")
else:
print(f"Skipped renaming {file_path} as {new_file_path} already exists")
new_file_path = None new_file_path = None
if __name__ == '__main__': if __name__ == '__main__':