3b4f23c670 feat: 支持设置作者别名
1. 新增 mapping_data 配置参数
2. 新增自动更新作者昵称功能

Closes #176
Closes #194
Closes #199
Closes #229
2025-03-22 22:10:17 +08:00

26 lines
564 B
Python

from contextlib import suppress
from pathlib import Path
def file_switch(path: Path) -> None:
if path.exists():
path.unlink()
else:
path.touch()
def remove_empty_directories(path: Path) -> None:
exclude = {
"\\.",
"\\_",
"\\__",
}
for dir_path, dir_names, file_names in path.walk(
top_down=False,
):
if any(i in str(dir_path) for i in exclude):
continue
if not dir_names and not file_names:
with suppress(OSError):
dir_path.rmdir()