|
@@ -600,8 +600,18 @@ extension KMHomeViewController {
|
|
|
} else {
|
|
|
}
|
|
|
if success {
|
|
|
- NSDocumentController.shared.km_safe_openDocument(withContentsOf: URL(fileURLWithPath: path), display: true) { _, _, _ in
|
|
|
-
|
|
|
+ NSDocumentController.shared.km_safe_openDocument(withContentsOf: URL(fileURLWithPath: path), display: true) { document, isOpened, error in
|
|
|
+ if error != nil {
|
|
|
+ NSApp.presentError(error!)
|
|
|
+ } else {
|
|
|
+ if FileManager.default.fileExists(atPath: filePath) {
|
|
|
+ try? FileManager.default.removeItem(atPath: filePath)
|
|
|
+ }
|
|
|
+ if document is KMMainDocument {
|
|
|
+ let newDocument = document
|
|
|
+ (newDocument as! KMMainDocument).isNewCreated = true
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|