marinofaggiana hace 3 años
padre
commit
0903b53a53
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      iOSClient/Data/NCManageDatabase.swift

+ 10 - 0
iOSClient/Data/NCManageDatabase.swift

@@ -123,6 +123,16 @@ class NCManageDatabase: NSObject {
                         migration.deleteData(forType: tableMetadata.className())
                         migration.deleteData(forType: tableShare.className())
                         migration.deleteData(forType: tableTrash.className())
+                        // Delete OLD avatar image
+                        if var pathUrl = CCUtility.getDirectoryGroup() {
+                            pathUrl.appendPathComponent(NCGlobal.shared.appUserData)
+                            do {
+                                let fileURLs = try FileManager.default.contentsOfDirectory(at: pathUrl, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)
+                                for fileURL in fileURLs {
+                                    try FileManager.default.removeItem(at: fileURL)
+                                }
+                            } catch { }
+                        }
                     }
                     
                 }, shouldCompactOnLaunch: { totalBytes, usedBytes in