mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-09 18:30:59 +00:00
Added support for directory symbolic links
This commit is contained in:
1 parent
87cc62d1d8
commit
ee190d07c5
1 file changed
+22
-2
@@ -125,8 +125,8 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
|
||||
return;
|
||||
|
||||
[self stopEventStream];
|
||||
|
||||
NSArray *pathsToWatch = [NSArray arrayWithObject:aPath];
|
||||
|
||||
NSMutableArray *pathsToWatch = [NSMutableArray arrayWithObject:aPath];
|
||||
void *appPointer = (void *)self;
|
||||
FSEventStreamContext context = {0, appPointer, NULL, NULL, NULL};
|
||||
CFTimeInterval latency = 2.0;
|
||||
@@ -143,6 +143,26 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
|
||||
flags = kFSEventStreamCreateFlagUseCFTypes;
|
||||
}
|
||||
|
||||
// add symlinked directories
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSError *error;
|
||||
|
||||
NSArray *fileList = [fileManager contentsOfDirectoryAtPath:aPath error:&error];
|
||||
|
||||
for (NSString *node in fileList)
|
||||
{
|
||||
NSDictionary *attributes = [fileManager attributesOfItemAtPath:aPath error:&error];
|
||||
if ([[attributes objectForKey:@"NSFileType"] isEqualTo:NSFileTypeDirectory])
|
||||
{
|
||||
NSString *subDirectoryPath = [aPath stringByAppendingPathComponent:node];
|
||||
NSString *symlinkDestination = [fileManager destinationOfSymbolicLinkAtPath:subDirectoryPath error:&error];
|
||||
if (symlinkDestination)
|
||||
{
|
||||
[pathsToWatch addObject:subDirectoryPath];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream = FSEventStreamCreate(NULL, &fsevents_callback, &context, (CFArrayRef) pathsToWatch,
|
||||
[lastEventId unsignedLongLongValue], latency, flags);
|
||||
|
||||
|
||||
Reference in new issue
Block a user