Fix pathing problem with icon image urls

This commit is contained in:
Maurice Parker 2021-02-04 21:50:03 -06:00
parent f22c3c644c
commit 051309d98b
1 changed files with 3 additions and 2 deletions

View File

@ -107,10 +107,11 @@ extension Article {
if let image = iconImage() {
let fm = FileManager.default
var path = fm.urls(for: .cachesDirectory, in: .userDomainMask)[0]
let feedID = webFeed.webFeedID.replacingOccurrences(of: "/", with: "_")
#if os(macOS)
path.appendPathComponent(webFeed.webFeedID + "_smallIcon.tiff")
path.appendPathComponent(feedID + "_smallIcon.tiff")
#else
path.appendPathComponent(webFeed.webFeedID + "_smallIcon.png")
path.appendPathComponent(feedID + "_smallIcon.png")
#endif
fm.createFile(atPath: path.path, contents: image.image.dataRepresentation()!, attributes: nil)
return path