From d99c15592e7874d37c8c79ead4f84aa16d3af830 Mon Sep 17 00:00:00 2001 From: Makis Maropoulos Date: Fri, 3 Jun 2016 16:17:15 +0300 Subject: [PATCH] utils.file replace os.Remove with os.RemoveAll --- iris/main.go | 2 +- utils/file.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iris/main.go b/iris/main.go index 5e0102cd..67a2f61e 100644 --- a/iris/main.go +++ b/iris/main.go @@ -86,7 +86,7 @@ func downloadPackages() { // we don't exit on errors here. // try to remove the unzipped folder - utils.RemoveFile(installedDir) + utils.RemoveFile(installedDir[0 : len(installedDir)-1]) } func createPackage(packageName string, targetDir string) error { diff --git a/utils/file.go b/utils/file.go index 64b85e07..1cc8faa1 100644 --- a/utils/file.go +++ b/utils/file.go @@ -142,9 +142,9 @@ func Unzip(archive string, target string) (string, error) { return createdFolder, nil } -// RemoveFile removes a file and returns an error, if any +// RemoveFile removes a file or directory and returns an error, if any func RemoveFile(filePath string) error { - return ErrFileRemove.With(os.Remove(filePath)) + return ErrFileRemove.With(os.RemoveAll(filePath)) } // Install is just the flow of: downloadZip -> unzip -> removeFile(zippedFile)