From fb0beafa8dd46fe493a57a6fb4afc53edb620e35 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Thu, 22 Jun 2023 17:27:28 +0200 Subject: [PATCH] Swift fix (#1000) * swift fix * fix * fix again --- apps/desktop/crates/macos/src-swift/files.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/desktop/crates/macos/src-swift/files.swift b/apps/desktop/crates/macos/src-swift/files.swift index e245b8fc4..8a421201c 100644 --- a/apps/desktop/crates/macos/src-swift/files.swift +++ b/apps/desktop/crates/macos/src-swift/files.swift @@ -30,15 +30,17 @@ func getOpenWithApplications(urlString: SRString) -> SRObjectArray { .compactMap { url in Bundle(url: url)?.infoDictionary.map { ($0, url) } } - .compactMap { (dict, url) in - let name = SRString((dict["CFBundleDisplayName"] ?? dict["CFBundleName"]) as! String); + .compactMap { (dict, url) -> NSObject? in + guard let name = (dict["CFBundleDisplayName"] ?? dict["CFBundleName"]) as? String else { + return nil + }; if !url.path.contains("/Applications/") { return nil } return OpenWithApplication( - name: name, + name: SRString(name), id: SRString(dict["CFBundleIdentifier"] as! String), url: SRString(url.path) )