os.watch

package os.watch

Type members

Classlikes

class CFAllocatorRef extends PointerByReference
class CFArrayRef extends PointerByReference
@SerialVersionUID(0L)
object CFIndex
Companion:
class
@SerialVersionUID(0L)
class CFIndex extends NativeLong
Companion:
object
class CFRunLoopRef extends PointerByReference
Companion:
class
class CFStringRef extends PointerByReference
Companion:
object
object CarbonApi
Companion:
class
trait CarbonApi extends Library
Companion:
object
trait FSEventStreamCallback extends Callback
class FSEventStreamRef extends PointerByReference
class FSEventsWatcher(srcs: Seq[Path], onEvent: Set[Path] => Unit, logger: (String, Any) => Unit, latency: Double) extends Watcher
class WatchServiceWatcher(roots: Seq[Path], onEvent: Set[Path] => Unit, logger: (String, Any) => Unit) extends Watcher
abstract class Watcher extends AutoCloseable

Value members

Concrete methods

def watch(roots: Seq[Path], onEvent: Set[Path] => Unit, logger: (String, Any) => Unit): AutoCloseable

Efficiently watches the given roots folders for changes. Any time the filesystem is modified within those folders, the onEvent callback is called with the paths to the changed files or folders.

Efficiently watches the given roots folders for changes. Any time the filesystem is modified within those folders, the onEvent callback is called with the paths to the changed files or folders.

Once the call to watch returns, onEvent is guaranteed to receive a an event containing the path for:

  • Every file or folder that gets created, deleted, updated or moved within the watched folders

  • For copied or moved folders, the path of the new folder as well as every file or folder within it.

  • For deleted or moved folders, the root folder which was deleted/moved, but without the paths of every file that was within it at the original location

Note that watch does not provide any additional information about the changes happening within the watched roots folder, apart from the path at which the change happened. It is up to the onEvent handler to query the filesystem and figure out what happened, and what it wants to do.

watch currently only supports Linux and Mac-OSX, and not Windows.