A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/howeyc/fsnotify/issues/93 below:

WatchFlags not supported on Windows? · Issue #93 · howeyc/fsnotify · GitHub

Hi,
I've setup a watcher like this:

func setupConfigWatcher() {
    configWatcher, err := fsnotify.NewWatcher()
    if err != nil {
        log.Fatal("Setup Config Watcher:",err)
    }

    done := make(chan bool)

    go func() {
        for {
            select {
        case ev := <-configWatcher.Event:
            log.Println("event:", ev)
            if strings.HasSuffix(ev.Name, "obrot-dns.json") && ev.IsModify() {
                loadConfig(true)
                showConfig()
                }
        case err := <-configWatcher.Error:
            log.Println("error:",err)
        }
    }
    }()

    err = configWatcher.WatchFlags("cfg",fsnotify.FSN_MODIFY)

    if err != nil {
        log.Fatal(err)
    }

    <-done
}

The WatchFlags is intended to only watch for modifications. However, this seems to not work, I get CREATE and DELETE and RENAME events as well:

2014/03/22 22:41:43 event: "cfg.obrot-dns.json.swp": CREATE
2014/03/22 22:41:43 event: "cfg.obrot-dns.json.swp": MODIFY
2014/03/22 22:41:48 event: "cfg\4913": CREATE
2014/03/22 22:41:48 event: "cfg\4913": MODIFY
2014/03/22 22:41:48 event: "cfg\4913": DELETE
2014/03/22 22:41:48 event: "cfg\obrot-dns.json": RENAME
2014/03/22 22:41:48 event: "cfg\obrot-dns.json~": RENAME
2014/03/22 22:41:48 event: "cfg\obrot-dns.json~": MODIFY
2014/03/22 22:41:48 event: "cfg\obrot-dns.json": CREATE
2014/03/22 22:41:48 event: "cfg\obrot-dns.json": MODIFY

Is there some limitation in Windows (Win7 x64 on a NTFS drive if it matters)?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4