Removes temporary database backup on launch
This commit is contained in:
parent
cec169c9b2
commit
962d45e4f9
@ -62,29 +62,17 @@ extension DatabaseManager
|
||||
{
|
||||
guard !self.isStarted else { return }
|
||||
|
||||
do
|
||||
{
|
||||
if !FileManager.default.fileExists(atPath: DatabaseManager.backupDirectoryURL.path)
|
||||
{
|
||||
try FileManager.default.copyItem(at: DatabaseManager.defaultDirectoryURL(), to: DatabaseManager.backupDirectoryURL)
|
||||
}
|
||||
self.loadPersistentStores { (description, error) in
|
||||
guard error == nil else { return completionHandler(error) }
|
||||
|
||||
self.loadPersistentStores { (description, error) in
|
||||
guard error == nil else { return completionHandler(error) }
|
||||
self.prepareDatabase {
|
||||
self.isStarted = true
|
||||
|
||||
self.prepareDatabase {
|
||||
self.isStarted = true
|
||||
|
||||
NotificationCenter.default.post(name: DatabaseManager.didStartNotification, object: self)
|
||||
|
||||
completionHandler(nil)
|
||||
}
|
||||
NotificationCenter.default.post(name: DatabaseManager.didStartNotification, object: self)
|
||||
|
||||
completionHandler(nil)
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
completionHandler(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -502,12 +490,6 @@ extension DatabaseManager
|
||||
let artworkURL = gameURL.deletingPathExtension().appendingPathExtension("jpg")
|
||||
return artworkURL
|
||||
}
|
||||
|
||||
class var backupDirectoryURL: URL
|
||||
{
|
||||
let backupDirectoryURL = FileManager.default.documentsDirectory.appendingPathComponent("Database-Backup")
|
||||
return backupDirectoryURL
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Notifications -
|
||||
|
||||
Loading…
Reference in New Issue
Block a user