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.
|
// Dump Dumps data to certificates.
|
||||||
func Dump(data *StoredData, baseConfig *BaseConfig) error {
|
func Dump(data *StoredData, baseConfig *BaseConfig) error {
|
||||||
|
_, errExists := os.Stat(baseConfig.DumpPath)
|
||||||
|
|
||||||
if baseConfig.Clean {
|
if baseConfig.Clean && !os.IsNotExist(errExists) {
|
||||||
if err := os.RemoveAll(baseConfig.DumpPath); err != nil {
|
dir, err := ioutil.ReadDir(baseConfig.DumpPath)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
for _, f := range dir {
|
||||||
|
if err := os.RemoveAll(filepath.Join(baseConfig.DumpPath, f.Name())); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !baseConfig.DomainSubDir {
|
if !baseConfig.DomainSubDir {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user