preferences_other.go 643 B

1234567891011121314151617181920212223242526272829
  1. //go:build !ios && !android && !mobile
  2. // +build !ios,!android,!mobile
  3. package app
  4. import "path/filepath"
  5. // storagePath returns the location of the settings storage
  6. func (p *preferences) storagePath() string {
  7. return filepath.Join(p.app.storageRoot(), "preferences.json")
  8. }
  9. // storageRoot returns the location of the app storage
  10. func (a *fyneApp) storageRoot() string {
  11. return filepath.Join(rootConfigDir(), a.UniqueID())
  12. }
  13. func (p *preferences) watch() {
  14. watchFile(p.storagePath(), func() {
  15. p.prefLock.RLock()
  16. shouldIgnoreChange := p.savedRecently
  17. p.prefLock.RUnlock()
  18. if shouldIgnoreChange {
  19. return
  20. }
  21. p.load()
  22. })
  23. }