[dev_arch_opt_3.0] 添加删除文件逻辑

This commit is contained in:
lixiaopeng
2023-02-24 18:16:54 +08:00
parent a6642b5a7c
commit ae44ee9ba4
5 changed files with 31 additions and 13 deletions

View File

@@ -2,7 +2,6 @@ package com.zhjt.mogo_core_function_devatools.upgrade
import android.app.NotificationManager
import android.content.Context
import android.util.Log
import androidx.core.app.NotificationCompat
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.data.obu.MogoObuConst
@@ -18,7 +17,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.ZipUtils
import java.io.IOException
@@ -159,7 +157,8 @@ class UpgradeManager : IDownload {
}, 1000)
}
override fun onError(url: String?, errorMsg: String?) {}
override fun onError(url: String?, errorMsg: String?) {
}
})
}
@@ -194,16 +193,15 @@ class UpgradeManager : IDownload {
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "updateObuUpgradeStatus ---md5Path = $md5Path -----tarPath = $tarPath ")
CallerObuApiManager.uploadObuPack(arrayOf(md5Path, tarPath))
} catch (e: IOException) {
//解压失败
com.mogo.eagle.core.utilcode.util.UiThreadHandler.post {
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
}
//解压失败,删除文件夹
CallerObuApiManager.deleteObuFile()
e.printStackTrace()
}
}
override fun onError(url: String?, errorMsg: String?) {
//下载失败,删除文件夹
CallerObuApiManager.deleteObuFile()
}
})
}