Add 'environment' package
This commit adds a new environment package that manages all calls to the underlying operating system.
This commit is contained in:
parent
822c70cd69
commit
f19619ef9f
60 changed files with 539 additions and 308 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package wisski
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
|
|
@ -18,7 +17,7 @@ func (dis *Distillery) PruneBackups(io stream.IOStream) error {
|
|||
sPath := dis.SnapshotsArchivePath()
|
||||
|
||||
// list all the files
|
||||
entries, err := os.ReadDir(sPath)
|
||||
entries, err := dis.Core.Environment.ReadDir(sPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -44,7 +43,7 @@ func (dis *Distillery) PruneBackups(io stream.IOStream) error {
|
|||
path := filepath.Join(sPath, entry.Name())
|
||||
io.Printf("Removing %s cause it is older than %d days", path, dis.Config.MaxBackupAge)
|
||||
|
||||
if err := os.Remove(path); err != nil {
|
||||
if err := dis.Core.Environment.Remove(path); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue