mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +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
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync/atomic"
|
"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
|
// CheckHomeFreeSpace returns nil if the home disk has the required amount of
|
||||||
// free space, or if home disk free space checking is disabled.
|
// free space, or if home disk free space checking is disabled.
|
||||||
func (w *Wrapper) CheckHomeFreeSpace() error {
|
func (w *Wrapper) CheckHomeFreeSpace() error {
|
||||||
if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, filepath.Dir(w.ConfigPath())).Usage("."); err == nil {
|
path := filepath.Dir(w.ConfigPath())
|
||||||
return checkFreeSpace(w.Options().MinHomeDiskFree, usage)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user