OpenUser opens user dictionary of words
()
| 68 | |
| 69 | // OpenUser opens user dictionary of words |
| 70 | func (sp *SpellData) OpenUser() error { |
| 71 | sp.mu.Lock() |
| 72 | defer sp.mu.Unlock() |
| 73 | d, err := OpenDict(sp.UserFile) |
| 74 | if err != nil { |
| 75 | // slog.Error(err.Error()) |
| 76 | sp.model.UserDict = make(Dict) |
| 77 | return err |
| 78 | } |
| 79 | // note: does not have suggestions for new words |
| 80 | // future impl will not precompile suggs so it is not worth it |
| 81 | sp.openTime, err = modTime(sp.UserFile) |
| 82 | sp.model.UserDict = d |
| 83 | return err |
| 84 | } |
| 85 | |
| 86 | // OpenUserCheck checks if the current user dict file has been modified |
| 87 | // since last open time and re-opens it if so. |