MCPcopy Create free account
hub / github.com/cogentcore/core / OpenUserCheck

Method OpenUserCheck

spell/spell.go:88–104  ·  view source on GitHub ↗

OpenUserCheck checks if the current user dict file has been modified since last open time and re-opens it if so.

()

Source from the content-addressed store, hash-verified

86// OpenUserCheck checks if the current user dict file has been modified
87// since last open time and re-opens it if so.
88func (sp *SpellData) OpenUserCheck() error {
89 if sp.UserFile == "" {
90 return nil
91 }
92 sp.mu.Lock()
93 defer sp.mu.Unlock()
94 tm, err := modTime(sp.UserFile)
95 if err != nil {
96 return err
97 }
98 if tm.After(sp.openTime) {
99 sp.OpenUser()
100 sp.openTime = tm
101 // log.Printf("opened newer spell file: %s\n", openTime.String())
102 }
103 return err
104}
105
106// SaveUser saves the user dictionary
107// note: this will overwrite any existing file; be sure to have opened

Callers 3

SaveUserIfLearnMethod · 0.95
AddWordMethod · 0.95
DeleteWordMethod · 0.95

Calls 4

OpenUserMethod · 0.95
modTimeFunction · 0.85
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected