diff --git a/.fontfoldercleanup/font_folder_cleanup.py b/.fontfoldercleanup/font_folder_cleanup.py index aecf88b..018b9a5 100644 --- a/.fontfoldercleanup/font_folder_cleanup.py +++ b/.fontfoldercleanup/font_folder_cleanup.py @@ -228,6 +228,8 @@ def remove_spaces_in_dir_names(root_path=font_location): if ' ' in dir: new_dir = dir.replace(' ', '-') #lowercase the new directory name + while new_dir.endswith('-'): + new_dir = new_dir[:-1] new_dir = new_dir.lower() new_dir_path = os.path.join(root, new_dir) os.rename(dir_path, new_dir_path) diff --git a/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py b/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py index 8e16c9b..b0863f7 100644 --- a/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py +++ b/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py @@ -2,9 +2,10 @@ import font_folder_cleanup import os def git_cleanup(): - os.system("cd $(git rev-parse --show-toplevel)") - os.system("git reset --hard") - os.system("git clean -fdx -e .env/ -e .idea/ -e .fontfoldercleanup/") + os.system("cd $(git rev-parse --show-toplevel) && git stash push -- .fontfoldercleanup/ && git reset --hard && git clean -fdx -e .env/ -e .idea/ -e .fontfoldercleanup/") + +def apply_stash(): + os.system("cd $(git rev-parse --show-toplevel) && git stash apply") if __name__ == '__main__': # Clean up git repository @@ -13,3 +14,4 @@ if __name__ == '__main__': font_folder_cleanup.remove_setup_complete_files() # Remove setup complete files from the repository font_folder_cleanup.remove_empty_folders() # Remove empty folders from the repository git_cleanup() # Clean up git repository again after removing files and folders + apply_stash() # Apply the stash to restore the files that were removed \ No newline at end of file diff --git a/.fontfoldercleanup/create repos for fonts.py b/.fontfoldercleanup/repo_tasks.py similarity index 100% rename from .fontfoldercleanup/create repos for fonts.py rename to .fontfoldercleanup/repo_tasks.py