Update NextNum/NextChar by entry position, not by Pattern

Two [[Files]] entries can now share a Pattern (with different
ValidInputDirs), and the counter of the first one was bumped for both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
sarahandClaude Opus 5.5 committed 2026-10-07 22:50:11 +02:00
1 parent 78216fc352
commit aef32f6f3b
1 file changed
+4 -9
+4 -9
View File
@@ -338,7 +338,7 @@ def DecideNewPath(FilePath):
if not FileConf: if not FileConf:
continue continue
for File in FileConf: for FileIndex, File in enumerate(FileConf):
if not FileInputValid(File, FilePath, ParentName): if not FileInputValid(File, FilePath, ParentName):
continue continue
@@ -368,10 +368,8 @@ def DecideNewPath(FilePath):
NewNum = str((int(File["NextNum"]) + 1)).rjust(Width, "0") NewNum = str((int(File["NextNum"]) + 1)).rjust(Width, "0")
print(File["NextNum"],"=>",NewNum) print(File["NextNum"],"=>",NewNum)
for Item in ConfData.get("Files", []): # By position: two entries can share a Pattern (with different ValidInputDirs).
if Item.get("Pattern") == File["Pattern"]: ConfData["Files"][FileIndex]["NextNum"] = NewNum
Item["NextNum"] = NewNum
break
with open(OutDirConfPath, "w", encoding="utf-8") as ConfFile: with open(OutDirConfPath, "w", encoding="utf-8") as ConfFile:
toml.dump(ConfData, ConfFile) toml.dump(ConfData, ConfFile)
@@ -403,10 +401,7 @@ def DecideNewPath(FilePath):
ConfData = toml.load(OutDirConfPath) ConfData = toml.load(OutDirConfPath)
for Item in ConfData.get("Files", []): ConfData["Files"][FileIndex]["NextChar"] = NewChar
if Item.get("Pattern") == File["Pattern"]:
Item["NextChar"] = NewChar
break
with open(OutDirConfPath, "w", encoding="utf-8") as ConfFile: with open(OutDirConfPath, "w", encoding="utf-8") as ConfFile:
toml.dump(ConfData, ConfFile) toml.dump(ConfData, ConfFile)