utils.file replace os.Remove with os.RemoveAll

This commit is contained in:
Makis Maropoulos 2016-06-03 16:17:15 +03:00
parent 8fd5830e2c
commit d99c15592e
2 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ func downloadPackages() {
// we don't exit on errors here. // we don't exit on errors here.
// try to remove the unzipped folder // try to remove the unzipped folder
utils.RemoveFile(installedDir) utils.RemoveFile(installedDir[0 : len(installedDir)-1])
} }
func createPackage(packageName string, targetDir string) error { func createPackage(packageName string, targetDir string) error {

View File

@ -142,9 +142,9 @@ func Unzip(archive string, target string) (string, error) {
return createdFolder, nil 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 { 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) // Install is just the flow of: downloadZip -> unzip -> removeFile(zippedFile)