From e8237d5458b354b70ce709edf04b564b36f3d661 Mon Sep 17 00:00:00 2001 From: abs3nt Date: Sat, 4 Mar 2023 22:28:42 -0800 Subject: [PATCH] improved: made watcher paths relative to the config file location --- src/haunt/cli.go | 2 +- src/haunt/projects.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/haunt/cli.go b/src/haunt/cli.go index 827bba8..cea8f13 100644 --- a/src/haunt/cli.go +++ b/src/haunt/cli.go @@ -128,7 +128,7 @@ func (r *Haunt) SetDefaults() { }, Watcher: Watch{ Exts: []string{"go"}, - Paths: []string{"/"}, + Paths: []string{"cmd/" + dir.Name()}, }, }) } else { diff --git a/src/haunt/projects.go b/src/haunt/projects.go index 8984eb6..63a0845 100644 --- a/src/haunt/projects.go +++ b/src/haunt/projects.go @@ -120,8 +120,7 @@ func (p *Project) Before() { p.cmd(p.stop, "before", true) // indexing files and dirs for _, dir := range p.Watcher.Paths { - base, _ := filepath.Abs(p.Path) - base = filepath.Join(base, dir) + base, _ := filepath.Abs(dir) if _, err := os.Stat(base); err == nil { if err := filepath.Walk(base, p.walk); err != nil { p.Err(err)