浏览代码

【多页签】打开了多个文档,在其中一个页签邮件查找Finder,会把所有已打开文档的Finder路径打开(已修复)

tangchao 1 年之前
父节点
当前提交
1a7574d5e3

+ 13 - 3
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1525,9 +1525,19 @@ extension KMMainViewController {
     }
 
     func showInFinder(_ sender: Any) -> Void {
-        let file: URL = (self.myDocument?.fileURL)!
-        if FileManager.default.fileExists(atPath: file.path) {
-            NSWorkspace.shared.activateFileViewerSelecting([file])
+        if sender is NSNotification {
+            let tabController = (sender as! NSNotification).object as? CTTabController
+            if tabController?.title == self.document?.documentURL.lastPathComponent {
+                let file: URL = (self.myDocument?.fileURL)!
+                if FileManager.default.fileExists(atPath: file.path) {
+                    NSWorkspace.shared.activateFileViewerSelecting([file])
+                }
+            }
+        } else {
+            let file: URL = (self.myDocument?.fileURL)!
+            if FileManager.default.fileExists(atPath: file.path) {
+                NSWorkspace.shared.activateFileViewerSelecting([file])
+            }
         }
     }