Skip to content

Commit

Permalink
Cache: fix artwork types
Browse files Browse the repository at this point in the history
  • Loading branch information
BLeeEZ committed May 14, 2024
1 parent afde421 commit 0c6cb2e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion AmperfyKit/Storage/CacheFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class CacheFileManager {
if createDirectoryIfNeeded(at: subDir) {
try? markItemAsExcludedFromBackup(at: subDir)
}
if fileManager.fileExists(atPath: to.path) {
try? self.removeItem(at: to)
}
try fileManager.moveItem(at: at, to: to)
try markItemAsExcludedFromBackup(at: to)
}
Expand Down Expand Up @@ -141,7 +144,11 @@ public class CacheFileManager {

public func createRelPath(for artwork: Artwork) -> URL? {
guard !artwork.managedObject.id.isEmpty else { return nil }
return Self.artworksDir.appendingPathComponent(artwork.managedObject.id)
if !artwork.type.isEmpty {
return Self.artworksDir.appendingPathComponent(artwork.type).appendingPathComponent(artwork.managedObject.id)
} else {
return Self.artworksDir.appendingPathComponent(artwork.managedObject.id)
}
}

public func createRelPath(for embeddedArtwork: EmbeddedArtwork) -> URL? {
Expand Down

0 comments on commit 0c6cb2e

Please sign in to comment.