瀏覽代碼

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

zhudongyong 1 年之前
父節點
當前提交
1eee8c1ada
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      KdanAutoTest/KdanAuto/Class/Tools/FileConveter/FileConverter.swift

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