Просмотр исходного кода

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 лет назад
Родитель
Сommit
ee40d4dec8
1 измененных файлов с 1 добавлено и 1 удалено
  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 {