worker: try to use same directory for the same file

This commit is contained in:
osy 2023-09-04 13:05:46 -07:00
parent d76d953697
commit 8482fec6be

View file

@ -337,7 +337,8 @@ extension Worker {
func download(_ file: ESDCatalog.File) {
let cacheUrl = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
let baseUrl = cacheUrl.appendingPathComponent(UUID().uuidString)
let uuid = file.sha1.count > 0 ? file.sha1 : UUID().uuidString
let baseUrl = cacheUrl.appendingPathComponent(uuid)
let esdUrl = baseUrl.appendingPathComponent(file.name)
let isoUrl = esdUrl.deletingPathExtension().appendingPathExtension("iso")
withBusyIndication { [self] in