1
0
Fork 0

gitignore_clean.py: FIXME: fix directory conflicts

This commit is contained in:
Intel A80486DX2-66 2024-03-08 16:14:14 +03:00
parent bcbdbf22e2
commit 50a83f3c0e
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
1 changed files with 5 additions and 2 deletions

View File

@ -3,7 +3,7 @@
from glob import glob
from os import remove as os_remove
from os.path import isdir as path_isdir, isfile as path_isfile, abspath, \
basename
basename, dirname
from pathlib import Path
from re import sub as re_sub
from shutil import rmtree
@ -58,9 +58,12 @@ def extend_wildcards(patterns: list) -> list:
def clean_gitignored_files(base_path: str = ".") -> None:
# FIXME: doesn't work as intended
for gitignore_path in list(Path(base_path).rglob("*.gitignore")):
directory = dirname(gitignore_path)
for file_path in extend_wildcards(read_gitignore(gitignore_path)):
delete(file_path)
full_path = directory + "/" + file_path
delete(full_path)
if __name__ == "__main__":