mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
lib/config: Add context to the home disk out of space error (#5241)
This commit is contained in:
parent
86a22b8086
commit
714a47ffb0
@ -7,6 +7,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync/atomic"
|
||||
@ -499,8 +500,11 @@ func (w *Wrapper) AddOrUpdatePendingFolder(id, label string, device protocol.Dev
|
||||
// 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 {
|
||||
if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, filepath.Dir(w.ConfigPath())).Usage("."); err == nil {
|
||||
return checkFreeSpace(w.Options().MinHomeDiskFree, usage)
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user