-
-
Notifications
You must be signed in to change notification settings - Fork 962
Closed
Description
Before reporting an issue, please ensure you are using the latest release of fsnotify.
Which operating system (GOOS) and version are you using?
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.14393 N/A Build 14393
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Please describe the issue that occurred.
Creating a file inside a folder created through windows explorer triggers an event for the New folder name, not the one actually chosen.
Are you able to reproduce the issue? Please provide steps to reproduce and a code sample if possible.
- Run this program:
- Create a new folder in the watched directory using windows explorer (it works if you just use powershell). Give it some name.
- Create a new folder or file or folder inside the folder you just created.
- You should see the error attached below
package main
import (
"fmt"
"log"
"github.com/fsnotify/fsnotify"
)
func main() {
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
err = watcher.Add(".")
if err != nil {
log.Fatal(err)
}
for ev := range watcher.Events {
fmt.Printf("got event %+v\n", ev)
if ev.Op == fsnotify.Create {
err = watcher.Add(ev.Name)
fmt.Println("adding ", ev.Name, "to watch list")
if err != nil {
log.Fatal(err)
}
}
}
}
You should see something like:
# using windows explorer, click on "New Folder"
got event "New folder": CREATE
adding New folder to watch list
# pick the name abc for the folder
got event "New folder": RENAME
got event "abc": CREATE
adding abc to watch list
# create another folder inside abc and you'll see the issue. It reports the new folder being created inside "New folder", not the chosen name "abc"
got event "New folder\\New folder": CREATE
adding New folder\New folder to watch list
# naturally, it fails because the folder doesn't exist so it can't be watched
2018/04/20 17:26:42 GetFileAttributes: The system cannot find the path specified.
exit status 1
If I run the program again and create a file inside abc, the events are triggered as expected.
fullmoon6661
Metadata
Metadata
Assignees
Labels
No labels