30 lines
643 B
Go
30 lines
643 B
Go
|
//go:build !ios && !android && !mobile
|
||
|
// +build !ios,!android,!mobile
|
||
|
|
||
|
package app
|
||
|
|
||
|
import "path/filepath"
|
||
|
|
||
|
// storagePath returns the location of the settings storage
|
||
|
func (p *preferences) storagePath() string {
|
||
|
return filepath.Join(p.app.storageRoot(), "preferences.json")
|
||
|
}
|
||
|
|
||
|
// storageRoot returns the location of the app storage
|
||
|
func (a *fyneApp) storageRoot() string {
|
||
|
return filepath.Join(rootConfigDir(), a.UniqueID())
|
||
|
}
|
||
|
|
||
|
func (p *preferences) watch() {
|
||
|
watchFile(p.storagePath(), func() {
|
||
|
p.prefLock.RLock()
|
||
|
shouldIgnoreChange := p.savedRecently
|
||
|
p.prefLock.RUnlock()
|
||
|
if shouldIgnoreChange {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
p.load()
|
||
|
})
|
||
|
}
|