소스 검색

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

zhudongyong 1 년 전
부모
커밋
42529c1c63
1개의 변경된 파일16개의 추가작업 그리고 2개의 파일을 삭제
  1. 16 2
      KdanAutoTest/KdanAuto/Class/Norrmal/AutoTestAdvanceSettingView.swift

+ 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) {