7.6: never sort system files or its own configs; macOS notes

This commit is contained in:
sarah committed 2026-10-14 13:18:17 +02:00
1 parent a6a5b28631
commit 418f0f581f
7 files changed
+27 -11

No files matched your search

+14 -2
View File
@@ -6,7 +6,7 @@ import shutil
import time
import toml
# Version = "7.5"
# Version = "7.6"
ConfPath = "./GlobalConf.toml"
@@ -403,6 +403,15 @@ def FileInputValid(File, FilePath, ParentName):
PartialDownloadSuffixes = (".part", ".crdownload", ".download")
# Files the system makes in every folder you look at (since 7.6): macOS' Finder writes .DS_Store,
# Windows' Explorer Thumbs.db and desktop.ini. Never sorted, whatever DotFiles says.
SystemFileNames = (".ds_store", "thumbs.db", "desktop.ini")
def IsSystemFile(FilePath):
return os.path.basename(FilePath).lower() in SystemFileNames
def IsPartialDownload(FilePath):
if os.path.basename(FilePath).lower().endswith(PartialDownloadSuffixes):
return True
@@ -679,9 +688,12 @@ def Main():
with open(FileHistoryPath, "w", encoding = "utf-8") as HistoryFile:
toml.dump({"Title": f"{os.path.basename(InputPath)} History", "History": [] }, HistoryFile)
# SaraSortd's own files in the folder (its configs and history) stay put, also with DotFiles = 1 (since 7.6).
OwnFiles = {Slashes(os.path.abspath(Own)) for Own in (DirConfPath(InputPath, "In"), DirConfPath(InputPath, "Out"), HistoryPath(InputPath))}
for FileName in os.listdir(InputPath):
FilePath = f"{InputPath}/{FileName}"
if IsPartialDownload(FilePath):
if IsPartialDownload(FilePath) or IsSystemFile(FilePath) or Slashes(os.path.abspath(FilePath)) in OwnFiles:
continue
if os.path.isdir(FilePath) and InputDirConf.get("SortDirs", 0) == 0: