Object / DOSNotify

This class is an anchor for DOS notifications, triggering its Update attribute when the watched file or directory is modified. For files, the attribute is set after the file is closed.

A unique thread is used to handle notification events, so you don't need to worry about managing your own message ports.

Not all filesystem will support this, in particular, most network filesystems won't support it.

Attributes

Overrides

Name -- (03.00) [I..], string

Defines the name of the file or directory that should be watched. This attribute is mandatory.

Example

#include <libraries/feelin.h>
#include <proto/feelin.h> #include <proto/exec.h> #include <proto/dos.h>
struct FeelinBase *FeelinBase;
#ifdef __amigaos4__ struct FeelinIFace *IFeelin; #endif
struct FS_DOSNotify_Update { STRPTR Name; };
F_HOOKM(uint32, Hook_Update, FS_DOSNotify_Update) { IFEELIN F_Log(FV_LOG_USER, "DOS object '%s' has been modified", Msg->Name);
return 0; }
int main(void) { if (F_FEELIN_OPEN) { FObject dn = DOSNotifyObject,
"Name", "ram:test.txt",
End;
if (dn) { IFEELIN F_Do ( dn, FM_Notify, "Update", FV_Notify_Always, FV_Notify_Self, FM_CallHookEntry, 2, Hook_Update, FV_Notify_Value );
IDOS_ Printf("Use Ctrl-C to terminate the demo.\n");
IEXEC Wait(SIGBREAKF_CTRL_C);
IFEELIN F_DisposeObj(dn); }
F_FEELIN_CLOSE; } return 0; }

Update -- (04.00) [.S.], string

When the file or directory monitored is modified, the attribute is set to the name of the file or directory.

Development