Fix: avoid unnecessary I/O when building cache file URL

For more details see the discussion on:

https://developer.apple.com/documentation/foundation/nsurl/1410614-urlbyappendingpathcomponent

Since we know that we're looking for a file and a trailing slash will
never be necessary, we can safely use the more specific version of the function
This commit is contained in:
Raja Baz
2020-06-30 11:09:03 +03:00
parent cc0eddfcad
commit ee40d4dec8

View File

@@ -228,7 +228,7 @@ public enum DiskStorage {
/// the `cacheKey` of an image `Source`. It is the computed key with processor identifier considered.
public func cacheFileURL(forKey key: String) -> URL {
let fileName = cacheFileName(forKey: key)
return directoryURL.appendingPathComponent(fileName)
return directoryURL.appendingPathComponent(fileName, isDirectory: false)
}
func cacheFileName(forKey key: String) -> String {