feat: Filter hidden and .disabled directories when reading
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 37s
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 37s
Upgraded hostsd to version 0.1.2, introducing logic to skip over directories that are either hidden (start with a '.') or intentionally disabled (end with '.disabled') during the directory reading process. This exclusion strategy enhances the performance by reducing unnecessary processing and aligns with common practices to temporarily disable directories without removing them. This update ensures a cleaner and more efficient directory scanning, particularly in environments where such control directories are prevalent.
This commit is contained in:
parent
e52ee7118f
commit
29992af943
2 changed files with 3 additions and 2 deletions
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||
|
||||
[project]
|
||||
name = "hostsd"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
authors = [
|
||||
{ name="Kumi Mitterer", email="hostsd@kumi.email" },
|
||||
]
|
||||
|
|
|
@ -54,7 +54,8 @@ def read_directory(
|
|||
yield f"# {full_path}\n\n{filecontent}"
|
||||
|
||||
elif infile.is_dir():
|
||||
yield from read_directory(infile, full_path)
|
||||
if not (infile.name.startswith(".") or infile.name.endswith(".disabled")):
|
||||
yield from read_directory(infile, full_path)
|
||||
|
||||
|
||||
def get_new_content(dirpath: Union[str, PathLike] = HOSTS_DIR) -> str:
|
||||
|
|
Loading…
Reference in a new issue