vendor/github.com/fsnotify/fsnotify/backend_other.go
changeset 265 05c40b36d3b2
equal deleted inserted replaced
264:8f478162d991 265:05c40b36d3b2
       
     1 //go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows
       
     2 // +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows
       
     3 
       
     4 package fsnotify
       
     5 
       
     6 import (
       
     7 	"fmt"
       
     8 	"runtime"
       
     9 )
       
    10 
       
    11 // Watcher watches a set of files, delivering events to a channel.
       
    12 type Watcher struct{}
       
    13 
       
    14 // NewWatcher creates a new Watcher.
       
    15 func NewWatcher() (*Watcher, error) {
       
    16 	return nil, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS)
       
    17 }
       
    18 
       
    19 // Close removes all watches and closes the events channel.
       
    20 func (w *Watcher) Close() error {
       
    21 	return nil
       
    22 }
       
    23 
       
    24 // Add starts monitoring the path for changes.
       
    25 //
       
    26 // A path can only be watched once; attempting to watch it more than once will
       
    27 // return an error. Paths that do not yet exist on the filesystem cannot be
       
    28 // added. A watch will be automatically removed if the path is deleted.
       
    29 //
       
    30 // A path will remain watched if it gets renamed to somewhere else on the same
       
    31 // filesystem, but the monitor will get removed if the path gets deleted and
       
    32 // re-created, or if it's moved to a different filesystem.
       
    33 //
       
    34 // Notifications on network filesystems (NFS, SMB, FUSE, etc.) or special
       
    35 // filesystems (/proc, /sys, etc.) generally don't work.
       
    36 //
       
    37 // # Watching directories
       
    38 //
       
    39 // All files in a directory are monitored, including new files that are created
       
    40 // after the watcher is started. Subdirectories are not watched (i.e. it's
       
    41 // non-recursive).
       
    42 //
       
    43 // # Watching files
       
    44 //
       
    45 // Watching individual files (rather than directories) is generally not
       
    46 // recommended as many tools update files atomically. Instead of "just" writing
       
    47 // to the file a temporary file will be written to first, and if successful the
       
    48 // temporary file is moved to to destination removing the original, or some
       
    49 // variant thereof. The watcher on the original file is now lost, as it no
       
    50 // longer exists.
       
    51 //
       
    52 // Instead, watch the parent directory and use Event.Name to filter out files
       
    53 // you're not interested in. There is an example of this in [cmd/fsnotify/file.go].
       
    54 func (w *Watcher) Add(name string) error {
       
    55 	return nil
       
    56 }
       
    57 
       
    58 // Remove stops monitoring the path for changes.
       
    59 //
       
    60 // Directories are always removed non-recursively. For example, if you added
       
    61 // /tmp/dir and /tmp/dir/subdir then you will need to remove both.
       
    62 //
       
    63 // Removing a path that has not yet been added returns [ErrNonExistentWatch].
       
    64 func (w *Watcher) Remove(name string) error {
       
    65 	return nil
       
    66 }