ref: 30e14cc31678ddc204b082ab362f86b6b8063881
parent: c825a7312131b4afa67ee90d593640dee3525d98
author: Anthony Fok <[email protected]>
date: Mon Jun 26 23:17:43 EDT 2017
Make `--navigateToChanged` more robust on Windows This ensures the new "open 'current content page' in browser" works on Windows, especially with Emacs and Vim. Special thanks to @bep for coming up with the idea of the fix. See #3645
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -1028,13 +1028,15 @@
}
func pickOneWritePath(events []fsnotify.Event) string {
+ name := ""
+
for _, ev := range events {
- if ev.Op&fsnotify.Write == fsnotify.Write {
- return ev.Name
+ if ev.Op&fsnotify.Write == fsnotify.Write && len(ev.Name) > len(name) {
+ name = ev.Name
}
}
- return ""
+ return name
}
func (c *commandeer) isStatic(path string) bool {