7.3: fix nested variables, catch-alls, paths and shared configs

- %Name% lookups also resolve inside the values they bring in, and unknown
  names are left as they are instead of crashing.
- Catch-all patterns ("*") are a fallback: specific patterns are tried first
  across all outputs, so a catch-all output listed first no longer takes
  every file.
- Directory paths only get %Name% lookups and date/time variables, so
  ! & @ ~ ^ in a path stay as they are; a leading ~ is the home directory.
- A directory config missing keys (one shared by a directory's input and
  output roles) gets them from the template instead of crashing SaraSortd.
- The history of a directory that sorts into itself compares file names as
  they are, so names with variable characters aren't re-sorted forever.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
sarahandClaude Opus 5.5 committed 2026-10-08 18:18:02 +02:00
1 parent 4389a1c76e
commit 234889ba6d
5 files changed
+170 -89

No files matched your search

+7 -5
View File
@@ -1,6 +1,6 @@
<img align="center" src="https://git.srhtnin.garden/sarah/RepoAssets/raw/branch/main/SaraSortd/Banners/SaraSortd.png" width="100%" alt="SaraSortd: a file and directory sorting daemon built with python."/>
(Version = "7.2")
(Version = "7.3")
It's made by Sarah, hence the name. :3
@@ -58,7 +58,7 @@ Here's a step-by-step tutorial (in case you don't want to watch the video).
```
Title = "SaraSortd Config" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "7.2" # Just the version number for the config file.
Version = "7.3" # Just the version number for the config file.
SafeMode = 1 # If SaraSortd should stop if an error with the config appears. 1 is stop, 0 is continue.
@@ -73,6 +73,7 @@ Logging = 1 # If SaraSortd's logging system should be active. If this is 0, noth
OverwriteDirConf = 0 # If SaraSortd should overwrite directory configs with the config templates. 0 is no, 1 is yes.
[Variables] # Only use these in config files, not the actual file names themselves.
# Directory paths (InputDir, OutputDir, LogDir, FailedDir, ValidInputDirs, DirConfDir, [DirConfs]) only use %Name% lookups and the date and time variables (since 7.3). The single-character variables below are about the file being sorted, so a path like "%RootDir%/Stuff&Things" stays as it is. A "~" at the start of a path is your home directory.
NextNum = "!" # The next available number. If 1 already exists, 2 will be used.
NextChar = "&" # The next available character. If A already exists, B will be used.
@@ -103,6 +104,7 @@ RootDir = "Unset" # A variable directory. This doesn't NEED to exist for the pro
InputDir = ["%RootDir%"] # If files get put here, they'll be sorted. This is a list, so you can add multiple. E.G: ["%RootDir%", "%RootDir%/input"]
OutputDir = ["%RootDir%/Output"] # Where sorted files go. This is a list, so you can add multiple. E.G: ["%RootDir%/Output", "%RootDir%/Output2"]. The output directories have separate config files.
# Outputs are tried in this order, first with their specific patterns. Catch-all patterns ("*") are only a fallback for files no specific pattern took (since 7.3), so an output that takes everything can be anywhere in the list.
LogDir = "%RootDir%/.Logs" # Where log files from SaraSortd go.
@@ -120,7 +122,7 @@ LogFileName = "[y].[m].[d]" # Name for log files.
InDirConfName = ".@Config" # Name for config files for input directories.
OutDirConfName = ".@Config" # Name for config files for output directories. If a directory is both an input and an output and both names are the same, it uses one config file for both.
OutDirConfName = ".@Config" # Name for config files for output directories. If a directory is both an input and an output and both names are the same, it uses one config file for both: its [[Files]] are then both the input's and the output's rules, and SaraSortd gives the file every key both roles need (since 7.3).
FileHistoryName = ".@History" # Name for file history files. This keeps track of sorted files if an input and output are the same directory.
@@ -167,7 +169,7 @@ The output directory config references the SaraSortd config (GlobalConf.toml). T
```
Title = "Unset" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "7.2" # The version number of the config.
Version = "7.3" # The version number of the config.
LastFile = "Unset" # The last file that was sorted to this directory. It gets automatically updated whenever a file gets sorted to this directory.
@@ -223,7 +225,7 @@ Overwrite = 1 # Whether this specific file type can be overwritten by others of
```
Title = "Unset" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "7.2"
Version = "7.3"
ParentDir = "Unset" # The name of this directory. It gets automatically updated when this config gets copied to an output directory.