lib/config, lib/model: Use path from locations to check disk space for db (#5525)

This commit is contained in:
Simon Frei
2019-02-12 13:25:11 +01:00
committed by Audrius Butkevicius
parent d85ef949be
commit 4299af1c63
4 changed files with 8 additions and 19 deletions

View File

@@ -7,14 +7,11 @@
package config
import (
"fmt"
"os"
"path/filepath"
"sync/atomic"
"time"
"github.com/syncthing/syncthing/lib/events"
"github.com/syncthing/syncthing/lib/fs"
"github.com/syncthing/syncthing/lib/osutil"
"github.com/syncthing/syncthing/lib/protocol"
"github.com/syncthing/syncthing/lib/sync"
@@ -488,15 +485,3 @@ func (w *Wrapper) AddOrUpdatePendingFolder(id, label string, device protocol.Dev
panic("bug: adding pending folder for non-existing device")
}
// CheckHomeFreeSpace returns nil if the home disk has the required amount of
// free space, or if home disk free space checking is disabled.
func (w *Wrapper) CheckHomeFreeSpace() error {
path := filepath.Dir(w.ConfigPath())
if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, path).Usage("."); err == nil {
if err = checkFreeSpace(w.Options().MinHomeDiskFree, usage); err != nil {
return fmt.Errorf("insufficient space on home disk (%v): %v", path, err)
}
}
return nil
}