From 28502b0d0367ea1c0f24345091802d392779e0ff Mon Sep 17 00:00:00 2001 From: Anand Sudhir Prayaga Date: Mon, 20 Aug 2018 14:23:57 +0200 Subject: [PATCH] Add support for ~ in config file path Fix #295 --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 1da83728..e1770367 100644 --- a/main.go +++ b/main.go @@ -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) }