Skip to content

Commit

Permalink
Fix get_new_path
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Mar 25, 2024
1 parent 44c4077 commit 0df5d10
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pycrdt_websocket/yutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ async def get_new_path(path: str) -> str:
ext = p.suffix
p_noext = p.with_suffix("")
i = 1
dir_list = [p async for p in anyio.Path().iterdir()]
while True:
new_path = f"{p_noext}({i}){ext}"
if new_path not in dir_list:
if not await anyio.Path(new_path).exists():
break
i += 1
return str(new_path)
return new_path

0 comments on commit 0df5d10

Please sign in to comment.