fix: named .npz files always start at _001
dog_bark_001.npz, dog_bark_002.npz instead of dog_bark.npz, dog_bark_001.npz. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,9 +72,6 @@ def _resolve_named_path(cache_dir: str, name: str) -> str:
|
||||
"""Return cache_dir/name.npz, incrementing to name_001.npz etc. if the file already exists."""
|
||||
# Sanitize: replace path separators so the name stays inside cache_dir
|
||||
name = name.replace("/", "_").replace("\\", "_").replace("\x00", "_")
|
||||
base = os.path.join(cache_dir, f"{name}.npz")
|
||||
if not os.path.exists(base):
|
||||
return base
|
||||
i = 1
|
||||
while True:
|
||||
p = os.path.join(cache_dir, f"{name}_{i:03d}.npz")
|
||||
|
||||
Reference in New Issue
Block a user