ref: rename template values

This commit is contained in:
relikd
2025-11-04 19:26:07 +01:00
parent 5250f48d38
commit 6898eeb42c
8 changed files with 58 additions and 61 deletions

View File

@@ -17,16 +17,11 @@ extension PreviewGenerator {
/// Process meta information about the file itself. Like file size and last modification.
mutating func procFileInfo(_ url: URL) {
let formattedValue : String
if let attrs = try? FileManager.default.attributesOfItem(atPath: url.path) {
let size = ByteCountFormatter.string(fromByteCount: getFileSize(url.path), countStyle: .file)
formattedValue = "\(size), Modified \((attrs[.modificationDate] as! Date).mediumFormat())"
} else {
formattedValue = ""
}
let attrs = try? FileManager.default.attributesOfItem(atPath: url.path)
self.apply([
"FileName": escapeXML(url.lastPathComponent),
"FileInfo": formattedValue,
"FileSize": ByteCountFormatter.string(fromByteCount: getFileSize(url.path), countStyle: .file),
"FileModified": (attrs?[.modificationDate] as? Date)?.mediumFormat() ?? "",
])
}
}