tools (common/files_utils): fixed get_unique_name when path is a str and not a Path

This commit is contained in:
Goffi 2020-01-27 19:53:31 +01:00
commit 5ffa208962

View file

@ -27,7 +27,7 @@ def get_unique_name(path):
@param path(str, Path): path to the file to create
@return (Path): unique path (can be the same as path if there is no conflict)
"""
ori_path = Path(path)
ori_path = path = Path(path)
idx = 1
while path.exists():
path = ori_path.with_name(ori_path.name + f"_{idx}")