GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - eswick/libfsmonitor: Library for monitoring iOS / OS X filesystems.

BranchesTags
Open more actions menu

Latest commit

 

History

18 Commits
18 Commits

Folders and files

NameName
Last commit message
Last commit date
fsmonitord
fsmonitord
 
 
layout
layout
 
 
FSMonitor.m
FSMonitor.m
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
NSDistributedNotificationCenter.h
NSDistributedNotificationCenter.h
 
 
README.md
README.md
 
 
theos
theos
 
 

Repository files navigation

libfsmonitor

##Overview##

libfsmonitor is an Objective-C library allows processes to be notified upon various filesystem events, such as files being created, modified, or deleted. The daemon (fsmonitord) trails /dev/fsevents and parses the data into an NSDictionary, which is then sent via CPDistributedNotificationCenter to any interested clients. Included is a small wrapper around CPDistributedNotificationCenter which handles listening and directory filtering.

Usage

Classes wishing to receive filesystem notification events must conform to the FSMonitorDelegate protocol.

Initialization

FSMonitor *filesystemMonitor = [FSMonitor new];
filesystemMonitor.delegate = self;

[filesystemMonitor addDirectoryFilter:[NSURL URLWithString:@"/path/to/monitor/"]];

Delegate Method

- (void)monitor:(FSMonitor*)monitor recievedEventInfo:(NSDictionary*)info{
    FSMonitorEventType type = [[info objectForKey:@"TYPE"] intValue];
    switch(type){
        case FSMonitorEventTypeRename:
        {
            NSString *originalName = [[info objectForKey:@"FILE"] path];
            NSString *newName = [[info objectForKey:@"DEST_FILE"] path];
            break;
        }
        case FSMonitorEventTypeDeletion:
            ...

Event Info

The info dictionary contains information about the event. All events include the following keys and their corresponding values:

  • FILE
  • The path of the file or directory involved with the event.
  • DEVICE_MAJOR
  • The major value of the physical drive FILE is located on.
  • DEVICE_MINOR
  • The minor value of the physical drive FILE is located on.
  • INODE
  • Whatever the hell an inode is.
  • MODE
  • The read/write/execute protections on FILE.
  • UID
  • The UID of the process that caused the event.
  • GID
  • The GID of the process that caused the event.

The only exception is FSMonitorEventTypeRename, which contains one extra value:

  • DEST_FILE
  • The path of the new file.

About

Library for monitoring iOS / OS X filesystems.

Resources

Readme
MIT license
Activity

Stars

26 stars

Watchers

2 watching

Forks

6 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.