Browse Source

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
Raja Baz 5 years ago
parent
commit
ee40d4dec8
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Sources/Cache/DiskStorage.swift

+ 1 - 1
Sources/Cache/DiskStorage.swift

@@ -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 {