mirror of
https://github.com/gohugoio/hugo.git
synced 2025-02-28 00:01:11 +00:00
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
This commit is contained in:
parent
c825a73121
commit
30e14cc316
1 changed files with 5 additions and 3 deletions
|
@ -1028,13 +1028,15 @@ func (c *commandeer) newWatcher(port int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func pickOneWritePath(events []fsnotify.Event) string {
|
func pickOneWritePath(events []fsnotify.Event) string {
|
||||||
|
name := ""
|
||||||
|
|
||||||
for _, ev := range events {
|
for _, ev := range events {
|
||||||
if ev.Op&fsnotify.Write == fsnotify.Write {
|
if ev.Op&fsnotify.Write == fsnotify.Write && len(ev.Name) > len(name) {
|
||||||
return ev.Name
|
name = ev.Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandeer) isStatic(path string) bool {
|
func (c *commandeer) isStatic(path string) bool {
|
||||||
|
|
Loading…
Reference in a new issue