From ab0b0f8a7f176079fb86f5fe473a16e7f7cdd172 Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Mon, 25 Sep 2023 03:50:17 -0600 Subject: [PATCH] filter the base directory from ignoreDirs (#2869) * filter the base directory from ignoreDirs * added PR 2869 --------- Co-authored-by: Lea Anthony --- v2/cmd/wails/internal/dev/watcher.go | 6 ++++-- website/src/pages/changelog.mdx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/v2/cmd/wails/internal/dev/watcher.go b/v2/cmd/wails/internal/dev/watcher.go index 1406f0c1..499b76df 100644 --- a/v2/cmd/wails/internal/dev/watcher.go +++ b/v2/cmd/wails/internal/dev/watcher.go @@ -44,14 +44,16 @@ func initialiseWatcher(cwd string) (*fsnotify.Watcher, error) { func getIgnoreDirs(cwd string) []string { ignoreDirs := []string{filepath.Join(cwd, "build/*"), ".*", "node_modules"} - + baseDir := filepath.Base(cwd) // Read .gitignore into ignoreDirs f, err := os.Open(filepath.Join(cwd, ".gitignore")) if err == nil { scanner := bufio.NewScanner(f) for scanner.Scan() { line := scanner.Text() - ignoreDirs = append(ignoreDirs, line) + if line != baseDir { + ignoreDirs = append(ignoreDirs, line) + } } } diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index cd7e0e69..52189972 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853) - Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863) - Fixed build hook command parsing. Added by @smac89 in [PR](https://github.com/wailsapp/wails/pull/2836) +- Fixed filesystem watcher from filtering top level project directory if binary name is included in .gitignore. Added by [@haukened](https://github.com/haukened) in [PR #2869](https://github.com/wailsapp/wails/pull/2869) - Fixed `-reloaddir` flag to watch additional directories (non-recursively). [@haukened](https://github.com/haukened) in [PR #2871](https://github.com/wailsapp/wails/pull/2871) - Fixed support for Go 1.21 `go.mod` files. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2876)