Logging of changed caps

This commit is contained in:
Christoph Hagen 2022-05-28 22:09:29 +02:00
parent d037042563
commit b9106bc52d

View File

@ -203,6 +203,7 @@ final class CapServer {
throw CapError.invalidData
}
caps[cap.id] = cap
log("Added cap \(cap.id) '\(cap.name)'")
}
private func update(_ existingCap: Cap, with cap: Cap) throws {
@ -210,13 +211,14 @@ final class CapServer {
if cap.name != "" {
updatedCap.name = cap.name
}
let url = file(of: cap.id, version: cap.mainImage)
let url = file(of: existingCap.id, version: cap.mainImage)
if fm.fileExists(atPath: url.path) {
updatedCap.mainImage = cap.mainImage
}
if let color = cap.color {
updatedCap.color = color
}
caps[cap.id] = updatedCap
caps[existingCap.id] = updatedCap
log("Updated cap \(existingCap.id)")
}
}