Przeglądaj źródła

综合 - 详情界面,显示对照文件、显示结果文件 无法显示问题修复;

zhudongyong 1 rok temu
rodzic
commit
42529c1c63

+ 16 - 2
KdanAutoTest/KdanAuto/Class/Norrmal/AutoTestAdvanceSettingView.swift

@@ -432,15 +432,29 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
     }
     
     func fileCellNeedShowInFinder(_ cell:TestFileCellView, fileName:String, type:TestFileType) {
+        var nFileName = NSString(string: fileName)
+        
         var directory = _autoTestObj?.originFileDirectory()
         if (type == .Result) {
+            nFileName = NSString(string: nFileName.deletingPathExtension).appendingPathExtension(_autoTestObj?.extention() ?? "")! as NSString
             directory = _autoTestObj?.resultFileDirectory()
         }else if (type == .Compare) {
+            nFileName = NSString(string: nFileName.deletingPathExtension).appendingPathExtension(_autoTestObj?.extention() ?? "")! as NSString
             directory = _autoTestObj?.checkFileDirectory()
         }
         
-        var path = NSString(string: directory!).appendingPathComponent(fileName);
-        NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
+        var path = NSString(string: directory!).appendingPathComponent(nFileName as String);
+        if (FileManager.default.fileExists(atPath: path)) {
+            NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
+        }else {
+            path = NSString(string: path).deletingPathExtension.appending(".jpg")
+            
+            if (FileManager.default.fileExists(atPath: path)) {
+                NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
+            }else {
+                NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: NSString(string: path).deletingLastPathComponent)])
+            }
+        }
     }
     
     func fileCellNeedDelete(_ cell:TestFileCellView, fileName:String) {