1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add support for ~ in config file path

Fix #295
This commit is contained in:
Anand Sudhir Prayaga 2018-08-20 14:23:57 +02:00
parent 54e9db393c
commit 28502b0d03

View File

@ -140,6 +140,7 @@ func setTerm() {
func watchForConfigChanges(app *tview.Application, configFilePath string, grid *tview.Grid, pages *tview.Pages) {
watch := watcher.New()
absPath, _ := wtf.ExpandHomeDir(configFilePath)
// notify write events.
watch.FilterOps(watcher.Write)
@ -148,7 +149,7 @@ func watchForConfigChanges(app *tview.Application, configFilePath string, grid *
for {
select {
case <-watch.Event:
loadConfigFile(configFilePath)
loadConfigFile(absPath)
// Disable all widgets to stop scheduler goroutines and rmeove widgets from memory.
disableAllWidgets()
widgets = nil
@ -165,7 +166,7 @@ func watchForConfigChanges(app *tview.Application, configFilePath string, grid *
}()
// Watch config file for changes.
if err := watch.Add(configFilePath); err != nil {
if err := watch.Add(absPath); err != nil {
log.Fatalln(err)
}