fix: properly handle directory replacement
The previous version _also_ deleted the temp working dir, causing issues with subsequent directory access.
This commit is contained in:
20
plugins/builder/functions.go
Normal file
20
plugins/builder/functions.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
func removeAllContents(basePath string) error {
|
||||
dir, err := ioutil.ReadDir(basePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, d := range dir {
|
||||
os.RemoveAll(path.Join([]string{basePath, d.Name()}...))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user