2006-09-02 16:09:20 +00:00
|
|
|
//
|
|
|
|
// FileTreeDelegate.m
|
|
|
|
// BindTest
|
|
|
|
//
|
2006-09-04 18:46:18 +00:00
|
|
|
// Created by Vincent Spader on 8/20/06.
|
|
|
|
// Copyright 2006 Vincent Spader. All rights reserved.
|
2006-09-02 16:09:20 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "FileTreeWatcher.h"
|
|
|
|
|
|
|
|
@implementation FileTreeWatcher
|
|
|
|
|
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if (self)
|
|
|
|
{
|
|
|
|
kqueue = [[UKKQueue alloc] init];
|
|
|
|
[kqueue setDelegate:self];
|
|
|
|
|
|
|
|
watchedPaths = [[NSMutableArray alloc] init];
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[delegate release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)addPath: (NSString *)path
|
|
|
|
{
|
|
|
|
if ([watchedPaths containsObject:path] == NO) {
|
|
|
|
[watchedPaths addObject:path];
|
|
|
|
|
|
|
|
[kqueue addPath: path];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-17 18:11:29 +00:00
|
|
|
- (void)removePath: (NSString *)path
|
|
|
|
{
|
|
|
|
[watchedPaths removeObject:path];
|
|
|
|
[kqueue removePath:path];
|
|
|
|
}
|
|
|
|
|
2006-09-02 16:09:20 +00:00
|
|
|
-(void) setDelegate: (id)d
|
|
|
|
{
|
|
|
|
delegate = [d retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-(void) watcher: (id<UKFileWatcher>)kq receivedNotification: (NSString*)nm forPath: (NSString*)fpath
|
|
|
|
{
|
|
|
|
[delegate refreshPath: fpath];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|