From 9414c97c09dc0a7832ffcef546b93606b50a12c1 Mon Sep 17 00:00:00 2001 From: vspader Date: Mon, 18 Feb 2008 03:27:59 +0000 Subject: [PATCH] File tree panel now uses FSEvent API instead of kqueues. --- Cog.xcodeproj/project.pbxproj | 40 +- English.lproj/FileTreePanel.xib | 650 ++++++++++-------- FileTreeWindow/ContainedNode.m | 11 - FileTreeWindow/FileNode.m | 11 - FileTreeWindow/FileTreeDataSource.h | 2 + FileTreeWindow/FileTreeDataSource.m | 42 +- FileTreeWindow/PathNode.h | 5 +- FileTreeWindow/PathNode.m | 55 -- FileTreeWindow/PathWatcher.h | 31 + FileTreeWindow/PathWatcher.m | 94 +++ .../UKKQueue/UKFNSubscribeFileWatcher.h | 49 -- .../UKKQueue/UKFNSubscribeFileWatcher.m | 201 ------ ThirdParty/UKKQueue/UKFileWatcher.h | 62 -- ThirdParty/UKKQueue/UKFileWatcher.m | 38 - ThirdParty/UKKQueue/UKKQueue Readme.txt | 32 - ThirdParty/UKKQueue/UKKQueue.h | 122 ---- ThirdParty/UKKQueue/UKKQueue.m | 481 ------------- ThirdParty/UKKQueue/UKMainThreadProxy.h | 56 -- ThirdParty/UKKQueue/UKMainThreadProxy.m | 151 ---- 19 files changed, 530 insertions(+), 1603 deletions(-) create mode 100644 FileTreeWindow/PathWatcher.h create mode 100644 FileTreeWindow/PathWatcher.m delete mode 100644 ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.h delete mode 100644 ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.m delete mode 100644 ThirdParty/UKKQueue/UKFileWatcher.h delete mode 100644 ThirdParty/UKKQueue/UKFileWatcher.m delete mode 100644 ThirdParty/UKKQueue/UKKQueue Readme.txt delete mode 100644 ThirdParty/UKKQueue/UKKQueue.h delete mode 100644 ThirdParty/UKKQueue/UKKQueue.m delete mode 100644 ThirdParty/UKKQueue/UKMainThreadProxy.h delete mode 100644 ThirdParty/UKKQueue/UKMainThreadProxy.m diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 5ab01e0a4..cfdd1a9d7 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 07E18DF30D62B38400BB0E11 /* NSArray+ShuffleUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E18DF20D62B38400BB0E11 /* NSArray+ShuffleUtils.m */; }; 170680630B950158006BA573 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 170680620B950158006BA573 /* Growl.framework */; }; 170680840B950164006BA573 /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 170680620B950158006BA573 /* Growl.framework */; }; + 171192BD0D691ED600FD76C5 /* PathWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 171192BC0D691ED600FD76C5 /* PathWatcher.m */; }; 171B57DD0C091F2B00F6AFAF /* flac.icns in Resources */ = {isa = PBXBuildFile; fileRef = 171B57D90C091F2B00F6AFAF /* flac.icns */; }; 171B57DE0C091F2B00F6AFAF /* m4a.icns in Resources */ = {isa = PBXBuildFile; fileRef = 171B57DA0C091F2B00F6AFAF /* m4a.icns */; }; 171B57DF0C091F2B00F6AFAF /* mp3.icns in Resources */ = {isa = PBXBuildFile; fileRef = 171B57DB0C091F2B00F6AFAF /* mp3.icns */; }; @@ -44,10 +45,6 @@ 177EBFA70B8BC2A70000BC8C /* ImageTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF870B8BC2A70000BC8C /* ImageTextCell.m */; }; 177EBFAB0B8BC2A70000BC8C /* NDHotKeyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF8D0B8BC2A70000BC8C /* NDHotKeyControl.m */; }; 177EBFAD0B8BC2A70000BC8C /* NDHotKeyEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF8F0B8BC2A70000BC8C /* NDHotKeyEvent.m */; }; - 177EBFAF0B8BC2A70000BC8C /* UKFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF920B8BC2A70000BC8C /* UKFileWatcher.m */; }; - 177EBFB10B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF940B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.m */; }; - 177EBFB40B8BC2A70000BC8C /* UKKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF970B8BC2A70000BC8C /* UKKQueue.m */; }; - 177EBFB60B8BC2A70000BC8C /* UKMainThreadProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF990B8BC2A70000BC8C /* UKMainThreadProxy.m */; }; 177EC01F0B8BC2CF0000BC8C /* ClickField.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EC0130B8BC2CF0000BC8C /* ClickField.m */; }; 177EC0210B8BC2CF0000BC8C /* DBLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EC0150B8BC2CF0000BC8C /* DBLog.m */; }; 177EC0230B8BC2CF0000BC8C /* DragScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EC0170B8BC2CF0000BC8C /* DragScrollView.m */; }; @@ -475,6 +472,8 @@ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 1705F1420B8BCB0C00C8B40D /* English */ = {isa = PBXFileReference; lastKnownFileType = folder; name = English; path = English.lproj/Help; sourceTree = ""; }; 170680620B950158006BA573 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = ThirdParty/Frameworks/Growl.framework; sourceTree = ""; }; + 171192BB0D691ED600FD76C5 /* PathWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathWatcher.h; sourceTree = ""; }; + 171192BC0D691ED600FD76C5 /* PathWatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PathWatcher.m; sourceTree = ""; }; 171B57D90C091F2B00F6AFAF /* flac.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = flac.icns; sourceTree = ""; }; 171B57DA0C091F2B00F6AFAF /* m4a.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = m4a.icns; sourceTree = ""; }; 171B57DB0C091F2B00F6AFAF /* mp3.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = mp3.icns; sourceTree = ""; }; @@ -529,15 +528,6 @@ 177EBF8D0B8BC2A70000BC8C /* NDHotKeyControl.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NDHotKeyControl.m; sourceTree = ""; }; 177EBF8E0B8BC2A70000BC8C /* NDHotKeyEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NDHotKeyEvent.h; sourceTree = ""; }; 177EBF8F0B8BC2A70000BC8C /* NDHotKeyEvent.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NDHotKeyEvent.m; sourceTree = ""; }; - 177EBF910B8BC2A70000BC8C /* UKFileWatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UKFileWatcher.h; sourceTree = ""; }; - 177EBF920B8BC2A70000BC8C /* UKFileWatcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = UKFileWatcher.m; sourceTree = ""; }; - 177EBF930B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UKFNSubscribeFileWatcher.h; sourceTree = ""; }; - 177EBF940B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = UKFNSubscribeFileWatcher.m; sourceTree = ""; }; - 177EBF950B8BC2A70000BC8C /* UKKQueue Readme.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "UKKQueue Readme.txt"; sourceTree = ""; }; - 177EBF960B8BC2A70000BC8C /* UKKQueue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UKKQueue.h; sourceTree = ""; }; - 177EBF970B8BC2A70000BC8C /* UKKQueue.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = UKKQueue.m; sourceTree = ""; }; - 177EBF980B8BC2A70000BC8C /* UKMainThreadProxy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UKMainThreadProxy.h; sourceTree = ""; }; - 177EBF990B8BC2A70000BC8C /* UKMainThreadProxy.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = UKMainThreadProxy.m; sourceTree = ""; }; 177EC0120B8BC2CF0000BC8C /* ClickField.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ClickField.h; sourceTree = ""; }; 177EC0130B8BC2CF0000BC8C /* ClickField.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ClickField.m; sourceTree = ""; }; 177EC0140B8BC2CF0000BC8C /* DBLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DBLog.h; sourceTree = ""; }; @@ -755,6 +745,8 @@ 17211A680D68B79700911CA9 /* FileNode.m */, 17211A6F0D68B79700911CA9 /* SmartFolderNode.h */, 17211A700D68B79700911CA9 /* SmartFolderNode.m */, + 171192BB0D691ED600FD76C5 /* PathWatcher.h */, + 171192BC0D691ED600FD76C5 /* PathWatcher.m */, ); path = FileTreeWindow; sourceTree = ""; @@ -793,7 +785,6 @@ 177EBF850B8BC2A70000BC8C /* ImageTextCell */, 179790DD0C087AB7001D6996 /* OpenURLPanel */, 177EBF8B0B8BC2A70000BC8C /* NDHotKeys */, - 177EBF900B8BC2A70000BC8C /* UKKQueue */, ); path = ThirdParty; sourceTree = ""; @@ -827,22 +818,6 @@ path = NDHotKeys; sourceTree = ""; }; - 177EBF900B8BC2A70000BC8C /* UKKQueue */ = { - isa = PBXGroup; - children = ( - 177EBF910B8BC2A70000BC8C /* UKFileWatcher.h */, - 177EBF920B8BC2A70000BC8C /* UKFileWatcher.m */, - 177EBF930B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.h */, - 177EBF940B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.m */, - 177EBF950B8BC2A70000BC8C /* UKKQueue Readme.txt */, - 177EBF960B8BC2A70000BC8C /* UKKQueue.h */, - 177EBF970B8BC2A70000BC8C /* UKKQueue.m */, - 177EBF980B8BC2A70000BC8C /* UKMainThreadProxy.h */, - 177EBF990B8BC2A70000BC8C /* UKMainThreadProxy.m */, - ); - path = UKKQueue; - sourceTree = ""; - }; 177EC0110B8BC2CF0000BC8C /* Utils */ = { isa = PBXGroup; children = ( @@ -1649,10 +1624,6 @@ 177EBFA70B8BC2A70000BC8C /* ImageTextCell.m in Sources */, 177EBFAB0B8BC2A70000BC8C /* NDHotKeyControl.m in Sources */, 177EBFAD0B8BC2A70000BC8C /* NDHotKeyEvent.m in Sources */, - 177EBFAF0B8BC2A70000BC8C /* UKFileWatcher.m in Sources */, - 177EBFB10B8BC2A70000BC8C /* UKFNSubscribeFileWatcher.m in Sources */, - 177EBFB40B8BC2A70000BC8C /* UKKQueue.m in Sources */, - 177EBFB60B8BC2A70000BC8C /* UKMainThreadProxy.m in Sources */, 177EC01F0B8BC2CF0000BC8C /* ClickField.m in Sources */, 177EC0210B8BC2CF0000BC8C /* DBLog.m in Sources */, 177EC0230B8BC2CF0000BC8C /* DragScrollView.m in Sources */, @@ -1694,6 +1665,7 @@ 17211A790D68B79700911CA9 /* SmartFolderNode.m in Sources */, 17E78CB10D68D46F005C5A59 /* StringToURLTransformer.m in Sources */, 56AE86C10D6901BC00B0F89B /* FontSizetoLineHeightTransformer.m in Sources */, + 171192BD0D691ED600FD76C5 /* PathWatcher.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/English.lproj/FileTreePanel.xib b/English.lproj/FileTreePanel.xib index 1bd421de5..2a2f4809e 100644 --- a/English.lproj/FileTreePanel.xib +++ b/English.lproj/FileTreePanel.xib @@ -74,7 +74,7 @@ 0 - LucidaGrande + LucidaGrande 1.100000e+01 3100 @@ -84,7 +84,7 @@ 6 - System + System headerTextColor 3 @@ -97,14 +97,14 @@ 2048 Text Cell - + 1.300000e+01 1044 6 - + controlBackgroundColor 3 @@ -113,7 +113,7 @@ 6 - + controlTextColor @@ -128,7 +128,7 @@ 6 - + gridColor 3 @@ -223,6 +223,9 @@ YES + + PathWatcher + @@ -245,7 +248,7 @@ - delegate + delegate @@ -279,6 +282,22 @@ 30 + + + + + + + 33 + + + + watcher + + + + 34 + @@ -398,6 +417,11 @@ + + 31 + + + @@ -427,6 +451,7 @@ 20.ImportedFromIB2 25.IBPluginDependency 26.IBPluginDependency + 31.IBPluginDependency 9.IBPluginDependency 9.ImportedFromIB2 @@ -455,6 +480,7 @@ + com.apple.InterfaceBuilder.CocoaPlugin @@ -479,14 +505,14 @@ - 30 + 34 YES - NSObject - + PathWatcher + NSObject YES @@ -497,173 +523,12 @@ - YES - - YES - - - YES - + + id - IBProjectSource - ThirdParty/UKKQueue/UKKQueue.h - - - - - - - YES - - YES - - - YES - - - - YES - - YES - - - YES - - - - - ThirdParty/UKKQueue/UKMainThreadProxy.h - - - - - - - YES - - YES - - - YES - - - - YES - - YES - - - YES - - - - - ThirdParty/UKKQueue/UKFileWatcher.h - - - - - - - YES - - YES - - - YES - - - - YES - - YES - - - YES - - - - - ThirdParty/AppleRemote/AppleRemote.h - - - - - - - YES - - YES - - - YES - - - - YES - - YES - - - YES - - - - - ThirdParty/NDHotKeys/NDHotKeyEvent.h - - - - - - - YES - - YES - - - YES - - - - YES - - YES - - - YES - - - - - ThirdParty/GCWindowMenu/GCOneShotEffectTimer.h - - - - FileTreeWindowController - NSWindowController - - YES - - YES - - - YES - - - - YES - - YES - - - YES - - - - - FileTreeWindow/FileTreeWindowController.h + IBProjectSource + FileTreeWindow/PathWatcher.h @@ -688,10 +553,36 @@ - + FileTreeWindow/FileIconCell.h + + FileTreeWindowController + NSWindowController + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + FileTreeWindow/FileTreeWindowController.h + + FileTreeDataSource @@ -705,11 +596,20 @@ - outlineView - NSOutlineView + YES + + YES + outlineView + + + + YES + NSOutlineView + PathWatcher + - + FileTreeWindow/FileTreeDataSource.h @@ -739,6 +639,162 @@ + + + + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + ThirdParty/UKKQueue/UKFileWatcher.h + + + + + + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + ThirdParty/UKKQueue/UKKQueue.h + + + + + + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + ThirdParty/UKKQueue/UKMainThreadProxy.h + + + + + + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + ThirdParty/GCWindowMenu/GCOneShotEffectTimer.h + + + + + + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + ThirdParty/AppleRemote/AppleRemote.h + + + + + + + YES + + YES + + + YES + + + + YES + + YES + + + YES + + + + + ThirdParty/NDHotKeys/NDHotKeyEvent.h + + ImageTextCell NSTextFieldCell @@ -761,7 +817,7 @@ - + ThirdParty/ImageTextCell/ImageTextCell.h @@ -772,123 +828,127 @@ 3 YnBsaXN0MDDUAAEAAgADAAQABQAGAAkAClgkdmVyc2lvblQkdG9wWSRhcmNoaXZlclgkb2JqZWN0cxIA -AYag0QAHAAhdSUIub2JqZWN0ZGF0YYABXxAPTlNLZXllZEFyY2hpdmVyrxCWAAsADAAxADUANgA8AD0A +AYag0QAHAAhdSUIub2JqZWN0ZGF0YYABXxAPTlNLZXllZEFyY2hpdmVyrxC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ChAjECwQ +MRBEEE0QTxBeEGAQYhBkEGYQaBBqEGwQfRCLEJQQnBCeEKAQohCkEK0QrxCxEL0QxhDIEMoQ3xDoEPEQ ++BEPER4RLxExETMRNRE3ET8RUBFSEVQRVhFYEV8RcBFyEXQRdhF4EYkRixGNEY8RkRGcEa0RrxGxEbMR +tRHBEeIR7BH2EgASHxIhEiMSJRInEikSKxItEjYSSRJLEkwSVRJcEncShBKkEqoSwxLQEtgS2hLdEt8S +4hLkEv0TFhMfEyQTMRM6E0ETWRNiE2QTgRODE4UThxOJE4sTjROPE5ETkxOVE5cTmRObE50TphOoE6oT +uBPBE8YTzxPRE+4T8BPyE/QT9hP4E/oT/BP+FAAUAhQEFAYUCBQKFBMUFRQ2FDgUOhQ8FD4UQBRCFEQU +RhRIFEoUTBROFFAUUhRUFF0UXxSAFIIUhBSGFIgUihSMFI4UkBSSFJQUlhSYFJoUnBSeFLsUyBTUFPEU +/hUSFSYVPBVGFWgVdRWCFY8VmxWkFaYVqRWrFbQVthW5FbsVxBXGFfUV9xX5FfsV/RX/FgEWAxYFFgcW +CRYLFg0WDxYRFhMWFRYXFhkWGxYdFh8WIRYqFiwWWxZdFl8WYRZjFmUWZxZpFmsWbRZvFnEWcxZ1FncW +eRZ7Fn0WfxaBFoMWhRaHFokWixaNFo8WkRaaFpwWnhagFqIWpBamFqgWqhasFq4WsBayFrQWtha/FsEW +whbLFs0WzhbXFtkW2hbjFugAAAAAAAACAgAAAAAAAAK7AAAAAAAAAAAAAAAAAAAW9w diff --git a/FileTreeWindow/ContainedNode.m b/FileTreeWindow/ContainedNode.m index 582ef87fa..f5e1c29f9 100644 --- a/FileTreeWindow/ContainedNode.m +++ b/FileTreeWindow/ContainedNode.m @@ -27,15 +27,4 @@ } } -//Disable watching for us, it doesn't matter. -- (void)startWatching -{ -} -- (void)stopWatching -{ -} -- (void)updatePathNotification:(NSNotification *)notification -{ -} - @end diff --git a/FileTreeWindow/FileNode.m b/FileTreeWindow/FileNode.m index 26dc62d0e..3b4c79cb7 100644 --- a/FileTreeWindow/FileNode.m +++ b/FileTreeWindow/FileNode.m @@ -15,15 +15,4 @@ return YES; } -//Disable watching for us, it doesn't matter. -- (void)startWatching -{ -} -- (void)stopWatching -{ -} -- (void)updatePathNotification:(NSNotification *)notification -{ -} - @end diff --git a/FileTreeWindow/FileTreeDataSource.h b/FileTreeWindow/FileTreeDataSource.h index 66ad54ab6..9834cc053 100644 --- a/FileTreeWindow/FileTreeDataSource.h +++ b/FileTreeWindow/FileTreeDataSource.h @@ -9,10 +9,12 @@ #import @class PathNode; +@class PathWatcher; @interface FileTreeDataSource : NSObject { PathNode *rootNode; + IBOutlet PathWatcher *watcher; IBOutlet NSOutlineView *outlineView; } diff --git a/FileTreeWindow/FileTreeDataSource.m b/FileTreeWindow/FileTreeDataSource.m index 4ea557583..cb7b7ae8a 100644 --- a/FileTreeWindow/FileTreeDataSource.m +++ b/FileTreeWindow/FileTreeDataSource.m @@ -11,6 +11,7 @@ #import "DNDArrayController.h" #import "DirectoryNode.h" +#import "PathWatcher.h" @implementation FileTreeDataSource @@ -48,14 +49,51 @@ - (void)setRootURL: (NSURL *)rootURL { - [[[[outlineView tableColumns] objectAtIndex:0] headerCell] setStringValue:[[NSFileManager defaultManager] displayNameAtPath:[rootURL path]]]; - [rootNode release]; rootNode = [[DirectoryNode alloc] initWithDataSource:self url:rootURL]; + [watcher setPath:[rootURL path]]; + [self reloadPathNode:rootNode]; } +- (PathNode *)nodeForPath:(NSString *)path +{ + NSString *relativePath = [path stringByReplacingOccurrencesOfString:[[[self rootURL] path] stringByAppendingString:@"/"] withString:@"" options:NSAnchoredSearch range:NSMakeRange(0, [path length])]; + relativePath = [relativePath stringByStandardizingPath]; + PathNode *theNode = rootNode; + NSLog(@"Root | Relative | Path: %@ | %@ | %@",[[self rootURL] path], relativePath, path); + for(NSString *c in [relativePath pathComponents]) + { + NSLog(@"COMPONENT: %@", c); + BOOL found = NO; + for (PathNode *node in [theNode subpaths]) { + if ([[[[node url] path] lastPathComponent] isEqualToString:c]) { + theNode = node; + found = YES; + } + } + + if (!found) + { + return nil; + } + NSLog(@"Component: %@", c); + } + + return theNode; +} + +- (void)pathDidChange:(NSString *)path +{ + NSLog(@"PATH DID CHANGE: %@", path); + //Need to find the corresponding node...and call [node reloadPath], then [self reloadPathNode:node] + PathNode *node = [self nodeForPath:path]; + NSLog(@"NODE IS: %@", node); + [node updatePath]; + [self reloadPathNode:node]; +} + - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { PathNode *n = (item == nil ? rootNode : item); diff --git a/FileTreeWindow/PathNode.h b/FileTreeWindow/PathNode.h index 434ef0904..f8627060b 100644 --- a/FileTreeWindow/PathNode.h +++ b/FileTreeWindow/PathNode.h @@ -37,8 +37,7 @@ - (BOOL)isLeaf; -- (void)startWatching; -- (void)stopWatching; -- (void)updatePathNotification:(NSNotification *)notification; +- (void)updatePath; + @end diff --git a/FileTreeWindow/PathNode.m b/FileTreeWindow/PathNode.m index 9812b63b4..4b216051e 100644 --- a/FileTreeWindow/PathNode.m +++ b/FileTreeWindow/PathNode.m @@ -12,8 +12,6 @@ #import "FileTreeDataSource.h" -#import "UKKQueue.h" - #import "FileNode.h" #import "DirectoryNode.h" #import "SmartFolderNode.h" @@ -59,49 +57,14 @@ NSURL *resolveAliases(NSURL *url) } -- (void)stopWatching -{ - if (url) - { - NSLog(@"Stopped watching...: %@", [url path]); - - //Remove all in one go - [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self]; - - [[UKKQueue sharedFileWatcher] removePath:[url path]]; - } -} - -- (void)startWatching -{ - if (url) - { - NSLog(@"WATCHING! %@", [url path]); - - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherRenameNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherWriteNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherDeleteNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherAttributeChangeNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherSizeIncreaseNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherLinkCountChangeNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(updatePathNotification:) name:UKFileWatcherAccessRevocationNotification object:nil]; - - [[UKKQueue sharedFileWatcher] addPath:[url path]]; - } -} - - (void)setURL:(NSURL *)u { [u retain]; - [self stopWatching]; - [url release]; url = u; - [self startWatching]; - [display release]; display = [[NSFileManager defaultManager] displayNameAtPath:[url path]]; [display retain]; @@ -122,22 +85,6 @@ NSURL *resolveAliases(NSURL *url) { } -- (void)updatePathNotification:(NSNotification *)notification -{ - [self performSelectorOnMainThread:@selector(updatePathNotificationMainThread:) withObject:notification waitUntilDone:YES]; -} - -- (void)updatePathNotificationMainThread:(NSNotification *)notification -{ - NSString *p = [[notification userInfo] objectForKey:@"path"]; - if ([p isEqualToString:[url path]]) - { - [self updatePath]; - - [dataSource reloadPathNode:self]; - } -} - - (void)processPaths: (NSArray *)contents { NSMutableArray *newSubpaths = [[NSMutableArray alloc] init]; @@ -234,8 +181,6 @@ NSURL *resolveAliases(NSURL *url) - (void)dealloc { - [self stopWatching]; - [url release]; [icon release]; diff --git a/FileTreeWindow/PathWatcher.h b/FileTreeWindow/PathWatcher.h new file mode 100644 index 000000000..3471b1ac1 --- /dev/null +++ b/FileTreeWindow/PathWatcher.h @@ -0,0 +1,31 @@ +// +// PathWatcher.h +// Cog +// +// Created by Vincent Spader on 2/17/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import +#include + + +@interface PathWatcher : NSObject { + FSEventStreamRef stream; + FSEventStreamContext *context; + + IBOutlet id delegate; +} + +- (void)setDelegate:(id)d; +- (id)delegate; + +- (void)setPath:(NSString *)path; //Set the path to watch +- (void)cleanUp; +@end + +@protocol PathWatcherDelegate + +- (void)pathDidChange:(NSString *)path; + +@end \ No newline at end of file diff --git a/FileTreeWindow/PathWatcher.m b/FileTreeWindow/PathWatcher.m new file mode 100644 index 000000000..685712262 --- /dev/null +++ b/FileTreeWindow/PathWatcher.m @@ -0,0 +1,94 @@ +// +// PathWatcher.m +// Cog +// +// Created by Vincent Spader on 2/17/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "PathWatcher.h" + +static void myFSEventCallback( + ConstFSEventStreamRef streamRef, + void *clientCallBackInfo, + size_t numEvents, + void *eventPaths, + const FSEventStreamEventFlags eventFlags[], + const FSEventStreamEventId eventIds[]) +{ + int i; + char **paths = eventPaths; + PathWatcher *pathWatcher = (PathWatcher *)clientCallBackInfo; + + printf("Callback called\n"); + for (i=0; iversion = 0; + context->info = (void *)self; + context->retain = NULL; + context->release = NULL; + + // Create the stream, passing in a callback + stream = FSEventStreamCreate(NULL, + &myFSEventCallback, + context, + pathsToWatch, + kFSEventStreamEventIdSinceNow, // Or a previous event ID + 1.0, //latency in seconds + kFSEventStreamCreateFlagNone // Watch this and all its subdirectories + ); + + FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + + FSEventStreamStart(stream); +} + +- (void)setDelegate:(id)d +{ + [d retain]; + [delegate release]; + delegate = d; +} +- (id)delegate +{ + return delegate; +} + +- (void) dealloc +{ + [self cleanUp]; + + [super dealloc]; +} + + +@end diff --git a/ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.h b/ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.h deleted file mode 100644 index 259cb8378..000000000 --- a/ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ============================================================================= - FILE: UKFNSubscribeFileWatcher.m - PROJECT: Filie - - COPYRIGHT: (c) 2005 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Commented, added singleton. - 2005-03-02 UK Created. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import -#import "UKFileWatcher.h" -#import - -/* - NOTE: FNSubscribe has a built-in delay: If your application is in the - background while the changes happen, all notifications will be queued up - and sent to your app at once the moment it is brought to front again. If - your app really needs to do live updates in the background, use a KQueue - instead. -*/ - -// ----------------------------------------------------------------------------- -// Class declaration: -// ----------------------------------------------------------------------------- - -@interface UKFNSubscribeFileWatcher : NSObject -{ - id delegate; // Delegate must respond to UKFileWatcherDelegate protocol. - NSMutableDictionary* subscriptions; // List of FNSubscription pointers in NSValues, with the pathnames as their keys. -} - -+(id) sharedFileWatcher; - -// UKFileWatcher defines the methods: addPath: removePath: and delegate accessors. - -// Private: --(void) sendDelegateMessage: (FNMessage)message forSubscription: (FNSubscriptionRef)subscription; - -@end diff --git a/ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.m b/ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.m deleted file mode 100644 index f4df11ee7..000000000 --- a/ThirdParty/UKKQueue/UKFNSubscribeFileWatcher.m +++ /dev/null @@ -1,201 +0,0 @@ -/* ============================================================================= - FILE: UKFNSubscribeFileWatcher.m - PROJECT: Filie - - COPYRIGHT: (c) 2005 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Commented, added singleton, added notifications. - 2005-03-02 UK Created. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import "UKFNSubscribeFileWatcher.h" -#import - - -// ----------------------------------------------------------------------------- -// Prototypes: -// ----------------------------------------------------------------------------- - -void UKFileSubscriptionProc(FNMessage message, OptionBits flags, void *refcon, FNSubscriptionRef subscription); - - -@implementation UKFNSubscribeFileWatcher - -// ----------------------------------------------------------------------------- -// sharedFileWatcher: -// Singleton accessor. -// ----------------------------------------------------------------------------- - -+(id) sharedFileWatcher -{ - static UKFNSubscribeFileWatcher* sSharedFileWatcher = nil; - - if( !sSharedFileWatcher ) - sSharedFileWatcher = [[UKFNSubscribeFileWatcher alloc] init]; // This is a singleton, and thus an intentional "leak". - - return sSharedFileWatcher; -} - - -// ----------------------------------------------------------------------------- -// * CONSTRUCTOR: -// ----------------------------------------------------------------------------- - --(id) init -{ - self = [super init]; - if( !self ) - return nil; - - subscriptions = [[NSMutableDictionary alloc] init]; - - return self; -} - - -// ----------------------------------------------------------------------------- -// * DESTRUCTOR: -// ----------------------------------------------------------------------------- - --(void) dealloc -{ - NSEnumerator* enny = [subscriptions objectEnumerator]; - NSValue* subValue = nil; - - while( (subValue = [enny nextObject]) ) - { - FNSubscriptionRef subscription = [subValue pointerValue]; - FNUnsubscribe( subscription ); - } - - [subscriptions release]; - [super dealloc]; -} - - -// ----------------------------------------------------------------------------- -// addPath: -// Start watching the object at the specified path. This only sends write -// notifications for all changes, as FNSubscribe doesn't tell what actually -// changed about our folder. -// ----------------------------------------------------------------------------- - --(void) addPath: (NSString*)path -{ - OSStatus err = noErr; - static FNSubscriptionUPP subscriptionUPP = NULL; - FNSubscriptionRef subscription = NULL; - - if( !subscriptionUPP ) - subscriptionUPP = NewFNSubscriptionUPP( UKFileSubscriptionProc ); - - err = FNSubscribeByPath( (UInt8*) [path fileSystemRepresentation], subscriptionUPP, (void*)self, - kNilOptions, &subscription ); - if( err != noErr ) - { - NSLog( @"UKFNSubscribeFileWatcher addPath: %@ failed due to error ID=%ld.", path, err ); - return; - } - - [subscriptions setObject: [NSValue valueWithPointer: subscription] forKey: path]; -} - - -// ----------------------------------------------------------------------------- -// removePath: -// Stop watching the object at the specified path. -// ----------------------------------------------------------------------------- - --(void) removePath: (NSString*)path -{ - NSValue* subValue = nil; - @synchronized( self ) - { - subValue = [[[subscriptions objectForKey: path] retain] autorelease]; - [subscriptions removeObjectForKey: path]; - } - - if( subValue ) - { - FNSubscriptionRef subscription = [subValue pointerValue]; - - FNUnsubscribe( subscription ); - } -} - - -// ----------------------------------------------------------------------------- -// sendDelegateMessage:forSubscription: -// Bottleneck for change notifications. This is called by our callback -// function to actually inform the delegate and send out notifications. -// -// This *only* sends out write notifications, as FNSubscribe doesn't tell -// what changed about our folder. -// ----------------------------------------------------------------------------- - --(void) sendDelegateMessage: (FNMessage)message forSubscription: (FNSubscriptionRef)subscription -{ - NSValue* subValue = [NSValue valueWithPointer: subscription]; - NSString* path = [[subscriptions allKeysForObject: subValue] objectAtIndex: 0]; - - [[[NSWorkspace sharedWorkspace] notificationCenter] postNotificationName: UKFileWatcherWriteNotification - object: self - userInfo: [NSDictionary dictionaryWithObjectsAndKeys: path, @"path", nil]]; - - [delegate watcher: self receivedNotification: UKFileWatcherWriteNotification forPath: path]; - //NSLog( @"UKFNSubscribeFileWatcher noticed change to %@", path ); // DEBUG ONLY! -} - - - -// ----------------------------------------------------------------------------- -// delegate: -// Accessor for file watcher delegate. -// ----------------------------------------------------------------------------- - --(id) delegate -{ - return delegate; -} - - -// ----------------------------------------------------------------------------- -// setDelegate: -// Mutator for file watcher delegate. -// ----------------------------------------------------------------------------- - --(void) setDelegate: (id)newDelegate -{ - delegate = newDelegate; -} - - -@end - - -// ----------------------------------------------------------------------------- -// UKFileSubscriptionProc: -// Callback function we hand to Carbon so it can tell us when something -// changed about our watched folders. We set the refcon to a pointer to -// our object. This simply extracts the object and hands the info off to -// sendDelegateMessage:forSubscription: which does the actual work. -// ----------------------------------------------------------------------------- - -void UKFileSubscriptionProc( FNMessage message, OptionBits flags, void *refcon, FNSubscriptionRef subscription ) -{ - UKFNSubscribeFileWatcher* obj = (UKFNSubscribeFileWatcher*) refcon; - - if( message == kFNDirectoryModifiedMessage ) // No others exist as of 10.4 - [obj sendDelegateMessage: message forSubscription: subscription]; - else - NSLog( @"UKFileSubscriptionProc: Unknown message %d", message ); -} \ No newline at end of file diff --git a/ThirdParty/UKKQueue/UKFileWatcher.h b/ThirdParty/UKKQueue/UKFileWatcher.h deleted file mode 100644 index c2c4ba28c..000000000 --- a/ThirdParty/UKKQueue/UKFileWatcher.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ============================================================================= - FILE: UKFileWatcher.h - PROJECT: Filie - - COPYRIGHT: (c) 2005 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Moved notification constants to .m file. - 2005-02-25 UK Created. - ========================================================================== */ - -/* - This is a protocol that file change notification classes should adopt. - That way, no matter whether you use Carbon's FNNotify/FNSubscribe, BSD's - kqueue or whatever, the object being notified can react to change - notifications the same way, and you can easily swap one out for the other - to cater to different OS versions, target volumes etc. -*/ - -// ----------------------------------------------------------------------------- -// Protocol: -// ----------------------------------------------------------------------------- - -@protocol UKFileWatcher - -// +(id) sharedFileWatcher; // Singleton accessor. Not officially part of the protocol, but use this name if you provide a singleton. - --(void) addPath: (NSString*)path; --(void) removePath: (NSString*)path; - --(id) delegate; --(void) setDelegate: (id)newDelegate; - -@end - -// ----------------------------------------------------------------------------- -// Methods delegates need to provide: -// ----------------------------------------------------------------------------- - -@interface NSObject (UKFileWatcherDelegate) - --(void) watcher: (id)kq receivedNotification: (NSString*)nm forPath: (NSString*)fpath; - -@end - - -// Notifications this sends: -/* object = the file watcher object - userInfo.path = file path watched - These notifications are sent via the NSWorkspace notification center */ -extern NSString* UKFileWatcherRenameNotification; -extern NSString* UKFileWatcherWriteNotification; -extern NSString* UKFileWatcherDeleteNotification; -extern NSString* UKFileWatcherAttributeChangeNotification; -extern NSString* UKFileWatcherSizeIncreaseNotification; -extern NSString* UKFileWatcherLinkCountChangeNotification; -extern NSString* UKFileWatcherAccessRevocationNotification; - diff --git a/ThirdParty/UKKQueue/UKFileWatcher.m b/ThirdParty/UKKQueue/UKFileWatcher.m deleted file mode 100644 index 952cf95fd..000000000 --- a/ThirdParty/UKKQueue/UKFileWatcher.m +++ /dev/null @@ -1,38 +0,0 @@ -/* ============================================================================= - FILE: UKKQueue.m - PROJECT: Filie - - COPYRIGHT: (c) 2005-06 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Created, moved notification constants here as exportable - symbols. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import -#import "UKFileWatcher.h" - - -// ----------------------------------------------------------------------------- -// Constants: -// ----------------------------------------------------------------------------- - -// Do not rely on the actual contents of these constants. They will eventually -// be changed to be more generic and less KQueue-specific. - -NSString* UKFileWatcherRenameNotification = @"UKKQueueFileRenamedNotification"; -NSString* UKFileWatcherWriteNotification = @"UKKQueueFileWrittenToNotification"; -NSString* UKFileWatcherDeleteNotification = @"UKKQueueFileDeletedNotification"; -NSString* UKFileWatcherAttributeChangeNotification = @"UKKQueueFileAttributesChangedNotification"; -NSString* UKFileWatcherSizeIncreaseNotification = @"UKKQueueFileSizeIncreasedNotification"; -NSString* UKFileWatcherLinkCountChangeNotification = @"UKKQueueFileLinkCountChangedNotification"; -NSString* UKFileWatcherAccessRevocationNotification = @"UKKQueueFileAccessRevocationNotification"; - diff --git a/ThirdParty/UKKQueue/UKKQueue Readme.txt b/ThirdParty/UKKQueue/UKKQueue Readme.txt deleted file mode 100644 index 582e3da96..000000000 --- a/ThirdParty/UKKQueue/UKKQueue Readme.txt +++ /dev/null @@ -1,32 +0,0 @@ -UKKQUEUE --------- - -A wrapper class around the kqueue file change notification mechanism. - -Simply create a UKKQueue (or use the singleton), add a few paths to it and listen to the change notifications via NSWorkspace's notification center. - -LICENSE: - -(c) 2003-06 by M. Uli Kusterer. You may redistribute, modify, use in -commercial products free of charge, however distributing modified copies -requires that you clearly mark them as having been modified by you, while -maintaining the original markings and copyrights. I don't like getting bug -reports about code I wasn't involved in. - -I'd also appreciate if you gave credit in your app's about screen or a similar -place. A simple "Thanks to M. Uli Kusterer" is quite sufficient. -Also, I rarely turn down any postcards, gifts, complementary copies of -applications etc. - - -REVISION HISTORY: -0.1 - Initial release. -0.2 - Now calls delegate on main thread using UKMainThreadProxy, and checks retain count to make sure the object is released even when the thread is still holding on to it. Equivalent to SVN revision 79. -0.3 - Now adopts UKFileWatcher protocol to allow swapping out a kqueue for another scheme easily. Uses O_EVONLY instead of O_RDONLY to open the file without preventing it from being deleted or its drive ejected. -0.4 - Now includes UKFNSubscribeFileWatcher, and closes the kqueue file descriptor in a separate thread (thanks to Dominic Yu for the suggestion!) so you don't have to wait for close() to time out. -0.5 - Turns off all deprecated features. Changes the notifications to make it possible to subscribe to them more selectively. Changes notification constants to be safer for apps that expose KQueue to their plugins. FNSubscribeFileWatcher now also sends notifications (sorry, "write" only). - - -CONTACT: -Get the newest version at http://www.zathras.de -E-Mail me at witness (at) zathras (dot) de or witness (dot) of (dot) teachtext (at) gmx (dot) net diff --git a/ThirdParty/UKKQueue/UKKQueue.h b/ThirdParty/UKKQueue/UKKQueue.h deleted file mode 100644 index facd513cb..000000000 --- a/ThirdParty/UKKQueue/UKKQueue.h +++ /dev/null @@ -1,122 +0,0 @@ -/* ============================================================================= - FILE: UKKQueue.h - PROJECT: Filie - - COPYRIGHT: (c) 2003 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Clarified license, streamlined UKFileWatcher stuff, - Changed notifications to be useful and turned off by - default some deprecated stuff. - 2003-12-21 UK Created. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import -#include -#include -#import "UKFileWatcher.h" - - -// ----------------------------------------------------------------------------- -// Constants: -// ----------------------------------------------------------------------------- - -// Backwards compatibility constants. Don't rely on code commented out with these constants, because it may be deleted in a future version. -#ifndef UKKQUEUE_BACKWARDS_COMPATIBLE -#define UKKQUEUE_BACKWARDS_COMPATIBLE 0 // 1 to send old-style kqueue:receivedNotification:forFile: messages to objects that accept them. -#endif - -#ifndef UKKQUEUE_SEND_STUPID_NOTIFICATIONS -#define UKKQUEUE_SEND_STUPID_NOTIFICATIONS 0 // 1 to send old-style notifications that have the path as the object and no userInfo dictionary. -#endif - -#ifndef UKKQUEUE_OLD_SINGLETON_ACCESSOR_NAME -#define UKKQUEUE_OLD_SINGLETON_ACCESSOR_NAME 0 // 1 to allow use of sharedQueue instead of sharedFileWatcher. -#endif - -#ifndef UKKQUEUE_OLD_NOTIFICATION_NAMES -#define UKKQUEUE_OLD_NOTIFICATION_NAMES 0 // 1 to allow use of old KQueue-style notification names instead of the new more generic ones in UKFileWatcher. -#endif - -// Flags for notifyingAbout: -#define UKKQueueNotifyAboutRename NOTE_RENAME // Item was renamed. -#define UKKQueueNotifyAboutWrite NOTE_WRITE // Item contents changed (also folder contents changed). -#define UKKQueueNotifyAboutDelete NOTE_DELETE // item was removed. -#define UKKQueueNotifyAboutAttributeChange NOTE_ATTRIB // Item attributes changed. -#define UKKQueueNotifyAboutSizeIncrease NOTE_EXTEND // Item size increased. -#define UKKQueueNotifyAboutLinkCountChanged NOTE_LINK // Item's link count changed. -#define UKKQueueNotifyAboutAccessRevocation NOTE_REVOKE // Access to item was revoked. - -// Notifications this sends: -// (see UKFileWatcher) -// Old names: *deprecated* -#if UKKQUEUE_OLD_NOTIFICATION_NAMES -#define UKKQueueFileRenamedNotification UKFileWatcherRenameNotification -#define UKKQueueFileWrittenToNotification UKFileWatcherWriteNotification -#define UKKQueueFileDeletedNotification UKFileWatcherDeleteNotification -#define UKKQueueFileAttributesChangedNotification UKFileWatcherAttributeChangeNotification -#define UKKQueueFileSizeIncreasedNotification UKFileWatcherSizeIncreaseNotification -#define UKKQueueFileLinkCountChangedNotification UKFileWatcherLinkCountChangeNotification -#define UKKQueueFileAccessRevocationNotification UKFileWatcherAccessRevocationNotification -#endif - - -// ----------------------------------------------------------------------------- -// UKKQueue: -// ----------------------------------------------------------------------------- - -@interface UKKQueue : NSObject -{ - int queueFD; // The actual queue ID (Unix file descriptor). - NSMutableArray* watchedPaths; // List of NSStrings containing the paths we're watching. - NSMutableArray* watchedFDs; // List of NSNumbers containing the file descriptors we're watching. - id delegate; // Gets messages about changes instead of notification center, if specified. - id delegateProxy; // Proxy object to which we send messages so they reach delegate on the main thread. - BOOL alwaysNotify; // Send notifications even if we have a delegate? Defaults to NO. - BOOL keepThreadRunning; // Termination criterion of our thread. -} - -+(id) sharedFileWatcher; // Returns a singleton, a shared kqueue object Handy if you're subscribing to the notifications. Use this, or just create separate objects using alloc/init. Whatever floats your boat. - --(int) queueFD; // I know you unix geeks want this... - -// High-level file watching: (use UKFileWatcher protocol methods instead, where possible!) --(void) addPathToQueue: (NSString*)path; --(void) addPathToQueue: (NSString*)path notifyingAbout: (u_int)fflags; --(void) removePathFromQueue: (NSString*)path; - --(id) delegate; --(void) setDelegate: (id)newDelegate; - --(BOOL) alwaysNotify; --(void) setAlwaysNotify: (BOOL)n; - -#if UKKQUEUE_OLD_SINGLETON_ACCESSOR_NAME -+(UKKQueue*) sharedQueue; -#endif - -// private: --(void) watcherThread: (id)sender; --(void) postNotification: (NSString*)nm forFile: (NSString*)fp; // Message-posting bottleneck. - -@end - - -// ----------------------------------------------------------------------------- -// Methods delegates need to provide: -// * DEPRECATED * use UKFileWatcher delegate methods instead! -// ----------------------------------------------------------------------------- - -@interface NSObject (UKKQueueDelegate) - --(void) kqueue: (UKKQueue*)kq receivedNotification: (NSString*)nm forFile: (NSString*)fpath; - -@end diff --git a/ThirdParty/UKKQueue/UKKQueue.m b/ThirdParty/UKKQueue/UKKQueue.m deleted file mode 100644 index b48286fbd..000000000 --- a/ThirdParty/UKKQueue/UKKQueue.m +++ /dev/null @@ -1,481 +0,0 @@ -/* ============================================================================= - FILE: UKKQueue.m - PROJECT: Filie - - COPYRIGHT: (c) 2003 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Clarified license, streamlined UKFileWatcher stuff, - Changed notifications to be useful and turned off by - default some deprecated stuff. - 2004-12-28 UK Several threading fixes. - 2003-12-21 UK Created. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import "UKKQueue.h" -#import "UKMainThreadProxy.h" -#import -#import - - -// ----------------------------------------------------------------------------- -// Macros: -// ----------------------------------------------------------------------------- - -// @synchronized isn't available prior to 10.3, so we use a typedef so -// this class is thread-safe on Panther but still compiles on older OSs. - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 -#define AT_SYNCHRONIZED(n) @synchronized(n) -#else -#define AT_SYNCHRONIZED(n) -#endif - - -// ----------------------------------------------------------------------------- -// Globals: -// ----------------------------------------------------------------------------- - -static UKKQueue * gUKKQueueSharedQueueSingleton = nil; - - -@implementation UKKQueue - -// Deprecated: -#if UKKQUEUE_OLD_SINGLETON_ACCESSOR_NAME -+(UKKQueue*) sharedQueue -{ - return [self sharedFileWatcher]; -} -#endif - -// ----------------------------------------------------------------------------- -// sharedQueue: -// Returns a singleton queue object. In many apps (especially those that -// subscribe to the notifications) there will only be one kqueue instance, -// and in that case you can use this. -// -// For all other cases, feel free to create additional instances to use -// independently. -// -// REVISIONS: -// 2006-03-13 UK Renamed from sharedQueue. -// 2005-07-02 UK Created. -// ----------------------------------------------------------------------------- - -+(id) sharedFileWatcher -{ - AT_SYNCHRONIZED( self ) - { - if( !gUKKQueueSharedQueueSingleton ) - gUKKQueueSharedQueueSingleton = [[UKKQueue alloc] init]; // This is a singleton, and thus an intentional "leak". - } - - return gUKKQueueSharedQueueSingleton; -} - - -// ----------------------------------------------------------------------------- -// * CONSTRUCTOR: -// Creates a new KQueue and starts that thread we use for our -// notifications. -// -// REVISIONS: -// 2004-11-12 UK Doesn't pass self as parameter to watcherThread anymore, -// because detachNewThreadSelector retains target and args, -// which would cause us to never be released. -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(id) init -{ - self = [super init]; - if( self ) - { - queueFD = kqueue(); - if( queueFD == -1 ) - { - [self release]; - return nil; - } - - watchedPaths = [[NSMutableArray alloc] init]; - watchedFDs = [[NSMutableArray alloc] init]; - - // Start new thread that fetches and processes our events: - keepThreadRunning = YES; - [NSThread detachNewThreadSelector:@selector(watcherThread:) toTarget:self withObject:nil]; - } - - return self; -} - - -// ----------------------------------------------------------------------------- -// release: -// Since NSThread retains its target, we need this method to terminate the -// thread when we reach a retain-count of two. The thread is terminated by -// setting keepThreadRunning to NO. -// -// REVISIONS: -// 2004-11-12 UK Created. -// ----------------------------------------------------------------------------- - --(oneway void) release -{ - AT_SYNCHRONIZED(self) - { - //NSLog(@"%@ (%d)", self, [self retainCount]); - if( [self retainCount] == 2 && keepThreadRunning ) - keepThreadRunning = NO; - } - - [super release]; -} - -// ----------------------------------------------------------------------------- -// * DESTRUCTOR: -// Releases the kqueue again. -// -// REVISIONS: -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(void) dealloc -{ - delegate = nil; - [delegateProxy release]; - - if( keepThreadRunning ) - keepThreadRunning = NO; - - // Close all our file descriptors so the files can be deleted: - NSEnumerator* enny = [watchedFDs objectEnumerator]; - NSNumber* fdNum; - while( (fdNum = [enny nextObject]) ) - { - if( close( [fdNum intValue] ) == -1 ) - NSLog(@"dealloc: Couldn't close file descriptor (%d)", errno); - } - - [watchedPaths release]; - watchedPaths = nil; - [watchedFDs release]; - watchedFDs = nil; - - [super dealloc]; - - //NSLog(@"kqueue released."); -} - - -// ----------------------------------------------------------------------------- -// queueFD: -// Returns a Unix file descriptor for the KQueue this uses. The descriptor -// is owned by this object. Do not close it! -// -// REVISIONS: -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(int) queueFD -{ - return queueFD; -} - - -// ----------------------------------------------------------------------------- -// addPathToQueue: -// Tell this queue to listen for all interesting notifications sent for -// the object at the specified path. If you want more control, use the -// addPathToQueue:notifyingAbout: variant instead. -// -// REVISIONS: -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(void) addPathToQueue: (NSString*)path -{ - [self addPath: path]; -} - - --(void) addPath: (NSString*)path -{ - [self addPathToQueue: path notifyingAbout: UKKQueueNotifyAboutRename - | UKKQueueNotifyAboutWrite - | UKKQueueNotifyAboutDelete - | UKKQueueNotifyAboutAttributeChange]; -} - - -// ----------------------------------------------------------------------------- -// addPathToQueue:notfyingAbout: -// Tell this queue to listen for the specified notifications sent for -// the object at the specified path. -// -// REVISIONS: -// 2005-06-29 UK Files are now opened using O_EVTONLY instead of O_RDONLY -// which allows ejecting or deleting watched files/folders. -// Thanks to Phil Hargett for finding this flag in the docs. -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(void) addPathToQueue: (NSString*)path notifyingAbout: (u_int)fflags -{ - struct timespec nullts = { 0, 0 }; - struct kevent ev; - int fd = open( [path fileSystemRepresentation], O_EVTONLY, 0 ); - - if( fd >= 0 ) - { - EV_SET( &ev, fd, EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_CLEAR, - fflags, 0, (void*)path ); - - AT_SYNCHRONIZED( self ) - { - [watchedPaths addObject: path]; - [watchedFDs addObject: [NSNumber numberWithInt: fd]]; - kevent( queueFD, &ev, 1, NULL, 0, &nullts ); - } - } -} - - --(void) removePath: (NSString*)path -{ - [self removePathFromQueue: path]; -} - - -// ----------------------------------------------------------------------------- -// removePathFromQueue: -// Stop listening for changes to the specified path. This removes all -// notifications. Use this to balance both addPathToQueue:notfyingAbout: -// as well as addPathToQueue:. -// -// REVISIONS: -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(void) removePathFromQueue: (NSString*)path -{ - int index = 0; - int fd = -1; - - AT_SYNCHRONIZED( self ) - { - index = [watchedPaths indexOfObject: path]; - - if( index == NSNotFound ) - return; - - fd = [[watchedFDs objectAtIndex: index] intValue]; - - [watchedFDs removeObjectAtIndex: index]; - [watchedPaths removeObjectAtIndex: index]; - } - - if( close( fd ) == -1 ) - NSLog(@"removePathFromQueue: Couldn't close file descriptor (%d)", errno); -} - - -// ----------------------------------------------------------------------------- -// removeAllPathsFromQueue: -// Stop listening for changes to all paths. This removes all -// notifications. -// -// REVISIONS: -// 2004-12-28 UK Added as suggested by bbum. -// ----------------------------------------------------------------------------- - --(void) removeAllPathsFromQueue; -{ - AT_SYNCHRONIZED( self ) - { - NSEnumerator * fdEnumerator = [watchedFDs objectEnumerator]; - NSNumber * anFD; - - while( (anFD = [fdEnumerator nextObject]) != nil ) - close( [anFD intValue] ); - - [watchedFDs removeAllObjects]; - [watchedPaths removeAllObjects]; - } -} - - -// ----------------------------------------------------------------------------- -// watcherThread: -// This method is called by our NSThread to loop and poll for any file -// changes that our kqueue wants to tell us about. This sends separate -// notifications for the different kinds of changes that can happen. -// All messages are sent via the postNotification:forFile: main bottleneck. -// -// This also calls sharedWorkspace's noteFileSystemChanged. -// -// To terminate this method (and its thread), set keepThreadRunning to NO. -// -// REVISIONS: -// 2005-08-27 UK Changed to use keepThreadRunning instead of kqueueFD -// being -1 as termination criterion, and to close the -// queue in this thread so the main thread isn't blocked. -// 2004-11-12 UK Fixed docs to include termination criterion, added -// timeout to make sure the bugger gets disposed. -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(void) watcherThread: (id)sender -{ - int n; - struct kevent ev; - struct timespec timeout = { 5, 0 }; // 5 seconds timeout. - int theFD = queueFD; // So we don't have to risk accessing iVars when the thread is terminated. - - while( keepThreadRunning ) - { - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - - NS_DURING - n = kevent( queueFD, NULL, 0, &ev, 1, &timeout ); - if( n > 0 ) - { - if( ev.filter == EVFILT_VNODE ) - { - if( ev.fflags ) - { - NSString* fpath = [[(NSString *)ev.udata retain] autorelease]; // In case one of the notified folks removes the path. - - //NSLog(@"UKKQueue: Detected file change: %@ %i", fpath, fpath); - [[NSWorkspace sharedWorkspace] noteFileSystemChanged: fpath]; - - //NSLog(@"ev.flags = %u",ev.fflags); // DEBUG ONLY! - - if( (ev.fflags & NOTE_RENAME) == NOTE_RENAME ) - [self postNotification: UKFileWatcherRenameNotification forFile: fpath]; - if( (ev.fflags & NOTE_WRITE) == NOTE_WRITE ) - [self postNotification: UKFileWatcherWriteNotification forFile: fpath]; - if( (ev.fflags & NOTE_DELETE) == NOTE_DELETE ) - [self postNotification: UKFileWatcherDeleteNotification forFile: fpath]; - if( (ev.fflags & NOTE_ATTRIB) == NOTE_ATTRIB ) - [self postNotification: UKFileWatcherAttributeChangeNotification forFile: fpath]; - if( (ev.fflags & NOTE_EXTEND) == NOTE_EXTEND ) - [self postNotification: UKFileWatcherSizeIncreaseNotification forFile: fpath]; - if( (ev.fflags & NOTE_LINK) == NOTE_LINK ) - [self postNotification: UKFileWatcherLinkCountChangeNotification forFile: fpath]; - if( (ev.fflags & NOTE_REVOKE) == NOTE_REVOKE ) - [self postNotification: UKFileWatcherAccessRevocationNotification forFile: fpath]; - } - } - } - NS_HANDLER - NSLog(@"Error in UKKQueue watcherThread: %@",localException); - NS_ENDHANDLER - - [pool release]; - } - - // Close our kqueue's file descriptor: - if( close( theFD ) == -1 ) - NSLog(@"release: Couldn't close main kqueue (%d)", errno); - - //NSLog(@"exiting kqueue watcher thread."); -} - - -// ----------------------------------------------------------------------------- -// postNotification:forFile: -// This is the main bottleneck for posting notifications. If you don't want -// the notifications to go through NSWorkspace, override this method and -// send them elsewhere. -// -// REVISIONS: -// 2004-02-27 UK Changed this to send new notification, and the old one -// only to objects that respond to it. The old category on -// NSObject could cause problems with the proxy itself. -// 2004-10-31 UK Helloween fun: Make this use a mainThreadProxy and -// allow sending the notification even if we have a -// delegate. -// 2004-03-13 UK Documented. -// ----------------------------------------------------------------------------- - --(void) postNotification: (NSString*)nm forFile: (NSString*)fp -{ - if( delegateProxy ) - { - #if UKKQUEUE_BACKWARDS_COMPATIBLE - if( ![delegateProxy respondsToSelector: @selector(watcher:receivedNotification:forPath:)] ) - [delegateProxy kqueue: self receivedNotification: nm forFile: fp]; - else - #endif - [delegateProxy watcher: self receivedNotification: nm forPath: fp]; - } - - if( !delegateProxy || alwaysNotify ) - { - #if UKKQUEUE_SEND_STUPID_NOTIFICATIONS - [[[NSWorkspace sharedWorkspace] notificationCenter] postNotificationName: nm object: fp]; - #else - [[[NSWorkspace sharedWorkspace] notificationCenter] postNotificationName: nm object: self - userInfo: [NSDictionary dictionaryWithObjectsAndKeys: fp, @"path", nil]]; - #endif - } -} - --(id) delegate -{ - return delegate; -} - --(void) setDelegate: (id)newDelegate -{ - id oldProxy = delegateProxy; - delegate = newDelegate; - delegateProxy = [delegate copyMainThreadProxy]; - [oldProxy release]; -} - -// ----------------------------------------------------------------------------- -// Flag to send a notification even if we have a delegate: -// ----------------------------------------------------------------------------- - --(BOOL) alwaysNotify -{ - return alwaysNotify; -} - - --(void) setAlwaysNotify: (BOOL)n -{ - alwaysNotify = n; -} - - -// ----------------------------------------------------------------------------- -// description: -// This method can be used to help in debugging. It provides the value -// used by NSLog & co. when you request to print this object using the -// %@ format specifier. -// -// REVISIONS: -// 2004-11-12 UK Created. -// ----------------------------------------------------------------------------- - --(NSString*) description -{ - return [NSString stringWithFormat: @"%@ { watchedPaths = %@, alwaysNotify = %@ }", NSStringFromClass([self class]), watchedPaths, (alwaysNotify? @"YES" : @"NO") ]; -} - -@end - - diff --git a/ThirdParty/UKKQueue/UKMainThreadProxy.h b/ThirdParty/UKKQueue/UKMainThreadProxy.h deleted file mode 100644 index 9fd6ff453..000000000 --- a/ThirdParty/UKKQueue/UKMainThreadProxy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ============================================================================= - FILE: UKMainThreadProxy.h - PROJECT: UKMainThreadProxy - - PURPOSE: Send a message to object theObject to [theObject mainThreadProxy] - instead and the message will be received on the main thread by - theObject. - - COPYRIGHT: (c) 2004 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT License - - REVISIONS: - 2006-03-13 UK Clarified license. - 2004-10-14 UK Created. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import - - -// ----------------------------------------------------------------------------- -// Categories: -// ----------------------------------------------------------------------------- - -@interface NSObject (UKMainThreadProxy) - --(id) mainThreadProxy; // You can't init or release this object. --(id) copyMainThreadProxy; // Gives you a retained version. - -@end - - -// ----------------------------------------------------------------------------- -// Classes: -// ----------------------------------------------------------------------------- - -/* - This object is created as a proxy in a second thread for an existing object. - All messages you send to this object will automatically be sent to the other - object on the main thread, except NSObject methods like retain/release etc. -*/ - -@interface UKMainThreadProxy : NSObject -{ - IBOutlet id target; -} - --(id) initWithTarget: (id)targ; - -@end diff --git a/ThirdParty/UKKQueue/UKMainThreadProxy.m b/ThirdParty/UKKQueue/UKMainThreadProxy.m deleted file mode 100644 index c3517980e..000000000 --- a/ThirdParty/UKKQueue/UKMainThreadProxy.m +++ /dev/null @@ -1,151 +0,0 @@ -/* ============================================================================= - FILE: UKMainThreadProxy.h - PROJECT: UKMainThreadProxy - - PURPOSE: Send a message to object theObject to [theObject mainThreadProxy] - instead and the message will be received on the main thread by - theObject. - - COPYRIGHT: (c) 2004 M. Uli Kusterer, all rights reserved. - - AUTHORS: M. Uli Kusterer - UK - - LICENSES: MIT Licenseā - - REVISIONS: - 2006-03-13 UK Clarified license. - 2004-10-14 UK Created. - ========================================================================== */ - -// ----------------------------------------------------------------------------- -// Headers: -// ----------------------------------------------------------------------------- - -#import "UKMainThreadProxy.h" - - -@implementation UKMainThreadProxy - --(id) initWithTarget: (id)targ -{ - self = [super init]; - if( self ) - target = targ; - - return self; -} - - -// ----------------------------------------------------------------------------- -// Introspection overrides: -// ----------------------------------------------------------------------------- - --(BOOL) respondsToSelector: (SEL)itemAction -{ - BOOL does = [super respondsToSelector: itemAction]; - - return( does || [target respondsToSelector: itemAction] ); -} - - --(id) performSelector: (SEL)itemAction -{ - BOOL does = [super respondsToSelector: itemAction]; - if( does ) - return [super performSelector: itemAction]; - - if( ![target respondsToSelector: itemAction] ) - [self doesNotRecognizeSelector: itemAction]; - - [target retain]; - [target performSelectorOnMainThread: itemAction withObject: nil waitUntilDone: YES]; - [target release]; - - return nil; -} - - --(id) performSelector: (SEL)itemAction withObject: (id)obj -{ - BOOL does = [super respondsToSelector: itemAction]; - if( does ) - return [super performSelector: itemAction withObject: obj]; - - if( ![target respondsToSelector: itemAction] ) - [self doesNotRecognizeSelector: itemAction]; - - [target retain]; - [obj retain]; - [target performSelectorOnMainThread: itemAction withObject: obj waitUntilDone: YES]; - [obj release]; - [target release]; - - return nil; -} - - -// ----------------------------------------------------------------------------- -// Forwarding unknown methods to the target: -// ----------------------------------------------------------------------------- - --(NSMethodSignature*) methodSignatureForSelector: (SEL)itemAction -{ - NSMethodSignature* sig = [super methodSignatureForSelector: itemAction]; - - if( sig ) - return sig; - - return [target methodSignatureForSelector: itemAction]; -} - --(void) forwardInvocation: (NSInvocation*)invocation -{ - SEL itemAction = [invocation selector]; - - if( [target respondsToSelector: itemAction] ) - { - [invocation retainArguments]; - [target retain]; - [invocation performSelectorOnMainThread: @selector(invokeWithTarget:) withObject: target waitUntilDone: YES]; - [target release]; - } - else - [self doesNotRecognizeSelector: itemAction]; -} - - -// ----------------------------------------------------------------------------- -// Safety net: -// ----------------------------------------------------------------------------- - --(id) mainThreadProxy // Just in case someone accidentally sends this message to a main thread proxy. -{ - return self; -} - --(id) copyMainThreadProxy // Just in case someone accidentally sends this message to a main thread proxy. -{ - return [self retain]; -} - -@end - - -// ----------------------------------------------------------------------------- -// Shorthand notation for getting a main thread proxy: -// ----------------------------------------------------------------------------- - -@implementation NSObject (UKMainThreadProxy) - --(id) mainThreadProxy -{ - return [[[UKMainThreadProxy alloc] initWithTarget: self] autorelease]; -} - --(id) copyMainThreadProxy -{ - return [[UKMainThreadProxy alloc] initWithTarget: self]; -} - -@end -