avoid_duplicate_name函数中使用绝对路径,修复路径为.\时的bug

This commit is contained in:
g1879 2020-08-06 23:21:18 +08:00
parent 19ff6ba9f6
commit fa15282774

View File

@ -171,7 +171,7 @@ def avoid_duplicate_name(folder_path: str, file_name: str) -> str:
:param file_name: 要检查的文件名
:return: 可用的文件名
"""
file_Path = Path(folder_path).joinpath(file_name)
file_Path = Path(folder_path).absolute().joinpath(file_name)
while file_Path.exists():
ext_name = file_Path.suffix
base_name = file_Path.stem