From 02648678b4624a0c2c0167bc363df29ff9610a9f Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期五, 05 六月 2020 20:58:57 +0800
Subject: [PATCH] delete md5 dir after install sdk

---
 service/SdkInstall.go |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/service/SdkInstall.go b/service/SdkInstall.go
index 43f29a3..0543795 100644
--- a/service/SdkInstall.go
+++ b/service/SdkInstall.go
@@ -33,12 +33,16 @@
 
 	zipFilePath := configPatchPath + "/"+identifier+ext
 	unPackTargetPath := configPatchPath+"/"+identifier+"_basic/"
+	md5DirPath := configPatchPath+"/"+identifier
 	if util.Exists(zipFilePath) {
 		strMd5, e := util.FileMd5(zipFilePath)
 		if e !=nil || strMd5 == "" {
 			go os.Remove(zipFilePath)
 			if util.DirExists(unPackTargetPath) {
 				go os.RemoveAll(unPackTargetPath)
+			}
+			if util.DirExists(md5DirPath) {
+				go os.RemoveAll(md5DirPath)
 			}
 			return false,errors.New("鑾峰彇瀹夎鍖卪d5澶辫触")
 		}
@@ -52,6 +56,9 @@
 			go os.Remove(zipFilePath)
 			if util.DirExists(unPackTargetPath) {
 				go os.RemoveAll(unPackTargetPath)
+			}
+			if util.DirExists(md5DirPath) {
+				go os.RemoveAll(md5DirPath)
 			}
 			logger.Debug("strMd5 is", strMd5,"identifier is",identifier,"not equal")
 			return false,errors.New("鏍¢獙瀹夎鏂囦欢澶辫触")
@@ -72,6 +79,7 @@
 	//1.瑙e帇缂╂洿鏂板寘
 	unPackTargetPath := configPatchPath+"/"+identifier+"_basic/"
 	unPackFilePath := configPatchPath+"/"+identifier+ext
+	md5DirPath := configPatchPath+"/"+identifier
 	defer func() {
 		if util.Exists(unPackTargetPath) {
 			os.RemoveAll(unPackTargetPath)
@@ -79,6 +87,9 @@
 		if util.Exists(unPackFilePath) {
 			os.RemoveAll(unPackFilePath)
 		}
+		if util.DirExists(md5DirPath) {
+			go os.RemoveAll(md5DirPath)
+		}
 	}()
 
 	if util.Exists(unPackTargetPath) {

--
Gitblit v1.8.0