Browse Source

【主页】最近列表,文件路径调整

lizhe 1 year ago
parent
commit
874eaa1321

+ 3 - 3
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -189,15 +189,15 @@ import Cocoa
         
         //history
         self.homeContentView.historyDidSelect = { [unowned self] view, item in
-            self.openHistoryFilePath(url: item.filePath!)
+            self.openHistoryFilePath(url: item.url!)
         }
         
         self.homeContentView.historyRemoveFileAction = { [unowned self] view, item in
-            self.historyFile(deleteDocuments: [item.filePath!])
+            self.historyFile(deleteDocuments: [ item.url!])
         }
         
         self.homeContentView.historyShowPathAction = { [unowned self] view, item in
-            NSWorkspace.shared.open(item.filePath!.deletingLastPathComponent())
+            NSWorkspace.shared.open( item.url!.deletingLastPathComponent())
         }
         
         self.homeContentView.historyRemoveAllFileAction = { [unowned self] view in

+ 3 - 0
PDF Office/PDF Master/Class/KMFileManager/KMFile/KMFile.swift

@@ -10,10 +10,13 @@ import Cocoa
 class KMFile: NSObject {
     var filePath: String = "" {
         didSet {
+            self.url = NSURL(fileURLWithPath: filePath) as URL
             reloadData()
         }
     }
     
+    var url: URL?
+    
     var showPath: String = ""
     var pdfDocument: CPDFDocument?
     var systemPDFDocument: PDFDocument?