diff options
| author | Dustin Mierau <dustin@mierau.me> | 2025-11-10 21:00:43 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2025-11-10 21:00:43 -0800 |
| commit | ddb9c69b24a67ac140af9ff20f5c36bdef6fb51b (patch) | |
| tree | 0bb994f1ac7a608c90b33c402629b0c8b21caff4 /Hotline/Models/FileInfo.swift | |
| parent | a4263aea6e2875fa77783685985e5c8f7991337f (diff) | |
Remove "New" suffix from our transfer clients. Further cleanup. Allow previewing certain files with HFS types (but no extensions). Cleanup preview files when window closes.
Diffstat (limited to 'Hotline/Models/FileInfo.swift')
| -rw-r--r-- | Hotline/Models/FileInfo.swift | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Hotline/Models/FileInfo.swift b/Hotline/Models/FileInfo.swift index e3081c4..a2f0ea5 100644 --- a/Hotline/Models/FileInfo.swift +++ b/Hotline/Models/FileInfo.swift @@ -49,13 +49,19 @@ import UniformTypeIdentifiers var children: [FileInfo]? = nil var isPreviewable: Bool { - let fileExtension = (self.name as NSString).pathExtension.lowercased() + var fileExtension = (self.name as NSString).pathExtension.lowercased() + if fileExtension.isEmpty && !self.type.isEmpty { + let type = self.type.lowercased() + if let ext = FileManager.HFSTypeToExtension[type] { + fileExtension = ext + } + } + if let fileType = UTType(filenameExtension: fileExtension) { if fileType.canBePreviewedByQuickLook { return true } - print("FILE TYPE?", fileType, fileExtension, fileType.isSubtype(of: .pdf), fileType.isSupertype(of: .pdf)) if fileType.isSubtype(of: .image) { return true } |