Skip to content

Commit

Permalink
Add support for ~ in config file path
Browse files Browse the repository at this point in the history
Fix #295
  • Loading branch information
anandsudhir committed Aug 20, 2018
1 parent 54e9db3 commit 28502b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
}

Expand Down

0 comments on commit 28502b0

Please sign in to comment.