fix: remove only the dump folder content instead of the folder.
This commit is contained in:
parent
43ebd1bed3
commit
2fdc853d6d
@ -22,11 +22,18 @@ type FileInfo struct {
|
||||
|
||||
// Dump Dumps data to certificates.
|
||||
func Dump(data *StoredData, baseConfig *BaseConfig) error {
|
||||
_, errExists := os.Stat(baseConfig.DumpPath)
|
||||
|
||||
if baseConfig.Clean {
|
||||
if err := os.RemoveAll(baseConfig.DumpPath); err != nil {
|
||||
if baseConfig.Clean && !os.IsNotExist(errExists) {
|
||||
dir, err := ioutil.ReadDir(baseConfig.DumpPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, f := range dir {
|
||||
if err := os.RemoveAll(filepath.Join(baseConfig.DumpPath, f.Name())); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !baseConfig.DomainSubDir {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user