mirror of
https://git.srhtnin.garden/sarah/SaraSortd.git
synced 2026-10-13 18:38:11 +02:00
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:
1 parent
78216fc352
commit
aef32f6f3b
1 file changed
+4
-9
+4
-9
@@ -338,7 +338,7 @@ def DecideNewPath(FilePath):
|
||||
if not FileConf:
|
||||
continue
|
||||
|
||||
for File in FileConf:
|
||||
for FileIndex, File in enumerate(FileConf):
|
||||
if not FileInputValid(File, FilePath, ParentName):
|
||||
continue
|
||||
|
||||
@@ -368,10 +368,8 @@ def DecideNewPath(FilePath):
|
||||
NewNum = str((int(File["NextNum"]) + 1)).rjust(Width, "0")
|
||||
print(File["NextNum"],"=>",NewNum)
|
||||
|
||||
for Item in ConfData.get("Files", []):
|
||||
if Item.get("Pattern") == File["Pattern"]:
|
||||
Item["NextNum"] = NewNum
|
||||
break
|
||||
# By position: two entries can share a Pattern (with different ValidInputDirs).
|
||||
ConfData["Files"][FileIndex]["NextNum"] = NewNum
|
||||
|
||||
with open(OutDirConfPath, "w", encoding="utf-8") as ConfFile:
|
||||
toml.dump(ConfData, ConfFile)
|
||||
@@ -403,10 +401,7 @@ def DecideNewPath(FilePath):
|
||||
|
||||
ConfData = toml.load(OutDirConfPath)
|
||||
|
||||
for Item in ConfData.get("Files", []):
|
||||
if Item.get("Pattern") == File["Pattern"]:
|
||||
Item["NextChar"] = NewChar
|
||||
break
|
||||
ConfData["Files"][FileIndex]["NextChar"] = NewChar
|
||||
|
||||
with open(OutDirConfPath, "w", encoding="utf-8") as ConfFile:
|
||||
toml.dump(ConfData, ConfFile)
|
||||
|
||||
Reference in new issue
Block a user