Procházet zdrojové kódy

【Bug 修复】CSV 合并导出转换类型,会误将 csv 格式当作 zip 文档处理,进而无法对照测试 bug 修复

zhudongyong před 1 rokem
rodič
revize
1eee8c1ada

+ 7 - 4
KdanAutoTest/KdanAuto/Class/Tools/FileConveter/FileConverter.swift

@@ -325,10 +325,13 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPToolDelega
                 
                 let zip = ZipArchive.init()
                 
-                zip.unzipOpenFile(cachePath)
-                zip.unzipFile(to: self.desPath, overWrite: true)
-                
-                try? FileManager.default.removeItem(atPath: cachePath)
+                if (zip.unzipOpenFile(cachePath) && zip.unzipFile(to: self.desPath, overWrite: true)) {
+                    
+                    try? FileManager.default.removeItem(atPath: cachePath)
+                }else {
+                    try? FileManager.default.moveItem(atPath: cachePath,
+                                                 toPath: self.desPath)
+                }
             }
             
             if self.pdfConverter?.isConverting == true {