tools (common/files_utils): fixed get_unique_name when path is a str and not a Path
This commit is contained in:
parent
af4320dfbe
commit
5ffa208962
1 changed files with 1 additions and 1 deletions
|
|
@ -27,7 +27,7 @@ def get_unique_name(path):
|
||||||
@param path(str, Path): path to the file to create
|
@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)
|
@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
|
idx = 1
|
||||||
while path.exists():
|
while path.exists():
|
||||||
path = ori_path.with_name(ori_path.name + f"_{idx}")
|
path = ori_path.with_name(ori_path.name + f"_{idx}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue