diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index c961a1b28..37d65df79 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -25,6 +25,8 @@ 1766C8970B912FB4004A7AE4 /* repeat_on.png in Resources */ = {isa = PBXBuildFile; fileRef = 1766C88F0B912FB4004A7AE4 /* repeat_on.png */; }; 1766C8980B912FB4004A7AE4 /* shuffle_off.png in Resources */ = {isa = PBXBuildFile; fileRef = 1766C8900B912FB4004A7AE4 /* shuffle_off.png */; }; 1766C8990B912FB4004A7AE4 /* shuffle_on.png in Resources */ = {isa = PBXBuildFile; fileRef = 1766C8910B912FB4004A7AE4 /* shuffle_on.png */; }; + 1769D7D10CC2BFF7003F455B /* FileTreeDataSource.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1769D7CF0CC2BFF7003F455B /* FileTreeDataSource.h */; }; + 1769D7D20CC2BFF7003F455B /* FileTreeDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 1769D7D00CC2BFF7003F455B /* FileTreeDataSource.m */; }; 1770429C0B8BC53600B86321 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 177042980B8BC53600B86321 /* AppController.m */; }; 1770429E0B8BC53600B86321 /* PlaybackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1770429A0B8BC53600B86321 /* PlaybackController.m */; }; 177EBF9E0B8BC2A70000BC8C /* AMRemovableColumnsTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF7A0B8BC2A70000BC8C /* AMRemovableColumnsTableView.m */; }; @@ -121,9 +123,7 @@ 8EFFCD610AA093AF00C458A5 /* FileIconCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD450AA093AF00C458A5 /* FileIconCell.m */; }; 8EFFCD630AA093AF00C458A5 /* FileNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD470AA093AF00C458A5 /* FileNode.m */; }; 8EFFCD650AA093AF00C458A5 /* FileOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD490AA093AF00C458A5 /* FileOutlineView.m */; }; - 8EFFCD670AA093AF00C458A5 /* FileTreeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD4B0AA093AF00C458A5 /* FileTreeController.m */; }; 8EFFCD690AA093AF00C458A5 /* FileTreeWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD4D0AA093AF00C458A5 /* FileTreeWatcher.m */; }; - 8EFFCD6D0AA093AF00C458A5 /* PathIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD510AA093AF00C458A5 /* PathIcon.m */; }; 8EFFCD6F0AA093AF00C458A5 /* PathNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFFCD530AA093AF00C458A5 /* PathNode.m */; }; /* End PBXBuildFile section */ @@ -418,6 +418,7 @@ 170680840B950164006BA573 /* Growl.framework in CopyFiles */, 17F94CCD0B8D090800A34E87 /* Sparkle.framework in CopyFiles */, 1791FF8F0CB43A2C0070BC5C /* MediaKeysApplication.h in CopyFiles */, + 1769D7D10CC2BFF7003F455B /* FileTreeDataSource.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +466,8 @@ 1766C88F0B912FB4004A7AE4 /* repeat_on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = repeat_on.png; path = Images/repeat_on.png; sourceTree = ""; }; 1766C8900B912FB4004A7AE4 /* shuffle_off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = shuffle_off.png; path = Images/shuffle_off.png; sourceTree = ""; }; 1766C8910B912FB4004A7AE4 /* shuffle_on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = shuffle_on.png; path = Images/shuffle_on.png; sourceTree = ""; }; + 1769D7CF0CC2BFF7003F455B /* FileTreeDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTreeDataSource.h; sourceTree = ""; }; + 1769D7D00CC2BFF7003F455B /* FileTreeDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FileTreeDataSource.m; sourceTree = ""; }; 1770424E0B8BC41800B86321 /* Cog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cog.app; sourceTree = BUILT_PRODUCTS_DIR; }; 177042970B8BC53600B86321 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; 177042980B8BC53600B86321 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = ""; }; @@ -614,8 +617,6 @@ 8EFFCD4B0AA093AF00C458A5 /* FileTreeController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = FileTreeController.m; sourceTree = ""; }; 8EFFCD4C0AA093AF00C458A5 /* FileTreeWatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FileTreeWatcher.h; sourceTree = ""; }; 8EFFCD4D0AA093AF00C458A5 /* FileTreeWatcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = FileTreeWatcher.m; sourceTree = ""; }; - 8EFFCD500AA093AF00C458A5 /* PathIcon.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PathIcon.h; sourceTree = ""; }; - 8EFFCD510AA093AF00C458A5 /* PathIcon.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PathIcon.m; sourceTree = ""; }; 8EFFCD520AA093AF00C458A5 /* PathNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PathNode.h; sourceTree = ""; }; 8EFFCD530AA093AF00C458A5 /* PathNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PathNode.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1146,10 +1147,10 @@ children = ( 8EFFCD440AA093AF00C458A5 /* FileIconCell.h */, 8EFFCD450AA093AF00C458A5 /* FileIconCell.m */, - 8EFFCD500AA093AF00C458A5 /* PathIcon.h */, - 8EFFCD510AA093AF00C458A5 /* PathIcon.m */, 8EFFCD480AA093AF00C458A5 /* FileOutlineView.h */, 8EFFCD490AA093AF00C458A5 /* FileOutlineView.m */, + 1769D7CF0CC2BFF7003F455B /* FileTreeDataSource.h */, + 1769D7D00CC2BFF7003F455B /* FileTreeDataSource.m */, 8EFFCD4A0AA093AF00C458A5 /* FileTreeController.h */, 8EFFCD4B0AA093AF00C458A5 /* FileTreeController.m */, 8EFFCD4C0AA093AF00C458A5 /* FileTreeWatcher.h */, @@ -1506,9 +1507,7 @@ 8EFFCD610AA093AF00C458A5 /* FileIconCell.m in Sources */, 8EFFCD630AA093AF00C458A5 /* FileNode.m in Sources */, 8EFFCD650AA093AF00C458A5 /* FileOutlineView.m in Sources */, - 8EFFCD670AA093AF00C458A5 /* FileTreeController.m in Sources */, 8EFFCD690AA093AF00C458A5 /* FileTreeWatcher.m in Sources */, - 8EFFCD6D0AA093AF00C458A5 /* PathIcon.m in Sources */, 8EFFCD6F0AA093AF00C458A5 /* PathNode.m in Sources */, 8E07AAF30AAC910500A4B32F /* SS_PrefsController.m in Sources */, 8E07AB790AAC930B00A4B32F /* PreferencesController.m in Sources */, @@ -1539,6 +1538,7 @@ 8E9A30160BA792DC0091081B /* NSFileHandle+CreateFile.m in Sources */, 179790E10C087AB7001D6996 /* OpenURLPanel.m in Sources */, 1791FF900CB43A2C0070BC5C /* MediaKeysApplication.m in Sources */, + 1769D7D20CC2BFF7003F455B /* FileTreeDataSource.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/English.lproj/MainMenu.nib/info.nib b/English.lproj/MainMenu.nib/info.nib index 590022da4..e953b87cb 100644 --- a/English.lproj/MainMenu.nib/info.nib +++ b/English.lproj/MainMenu.nib/info.nib @@ -15,7 +15,7 @@ 29 157 976 383 44 0 0 1680 1028 463 - 669 640 341 145 0 0 1680 1028 + 669 639 341 145 0 0 1680 1028 513 379 636 131 168 0 0 1680 1028 @@ -34,14 +34,14 @@ 4 IBOpenObjects - 463 - 29 - 1324 1063 268 + 29 21 1156 + 1324 513 + 463 IBSystem Version 8R2218 diff --git a/English.lproj/MainMenu.nib/keyedobjects.nib b/English.lproj/MainMenu.nib/keyedobjects.nib index f709b1b42..ddaaac14d 100644 Binary files a/English.lproj/MainMenu.nib/keyedobjects.nib and b/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/FileDrawer/DirectoryNode.h b/FileDrawer/DirectoryNode.h index f8938a04f..11116e689 100644 --- a/FileDrawer/DirectoryNode.h +++ b/FileDrawer/DirectoryNode.h @@ -11,11 +11,6 @@ @interface DirectoryNode : PathNode { - NSMutableArray *subpaths; - id controller; } --(id)initWithPath:(NSString *)p controller:(id) c; -- (NSArray *)subpaths; - @end diff --git a/FileDrawer/DirectoryNode.m b/FileDrawer/DirectoryNode.m index 9983e1a49..e0827badf 100644 --- a/FileDrawer/DirectoryNode.m +++ b/FileDrawer/DirectoryNode.m @@ -7,109 +7,33 @@ // #import "DirectoryNode.h" + #import "FileNode.h" #import "SmartFolderNode.h" +#import "FileTreeController.h" +#import "FileTreeWatcher.h" + @implementation DirectoryNode --(id)initWithPath:(NSString *)p controller:(id) c -{ - self = [super initWithPath:p]; - if (self) - { - controller = [c retain]; - } - - return self; -} - -- (void)dealloc { - [[controller watcher] removePath:[self path]]; - - if (subpaths) - [subpaths release]; - - [controller release]; - - [super dealloc]; -} - - (BOOL)isLeaf { return NO; } -- (void)processContents: (NSArray *)contents -{ - NSEnumerator *e = [contents objectEnumerator]; - NSString *s; - while ((s = [e nextObject])) - { - if ([s characterAtIndex:0] == '.') - { - continue; - } - - PathNode *newNode; - NSString *newSubpath = [path stringByAppendingPathComponent: s]; - - if ([[s pathExtension] caseInsensitiveCompare:@"savedSearch"] == NSOrderedSame) - { - newNode = [[SmartFolderNode alloc] initWithPath:newSubpath controller:controller]; - } - else - { - BOOL isDir; - - [[NSFileManager defaultManager] fileExistsAtPath:newSubpath isDirectory:&isDir]; - - if (!isDir && ![[controller acceptableFileTypes] containsObject:[s pathExtension]]) - { - continue; - } - - if (isDir) - newNode = [[DirectoryNode alloc] initWithPath: newSubpath controller:controller]; - else - newNode = [[FileNode alloc] initWithPath: newSubpath]; - } - - [subpaths addObject:newNode]; - - [newNode release]; - } -} - - (NSArray *)subpaths { if (subpaths == nil) { subpaths = [[NSMutableArray alloc] init]; NSArray *contents = [[[NSFileManager defaultManager] directoryContentsAtPath:path] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; + NSLog(@"Contents: %@", contents); + [self processPaths: contents]; - [self processContents: contents]; - - [[controller watcher] addPath:[self path]]; +// [[controller watcher] addPath:[self path]]; } return subpaths; } -- (void)setSubpaths:(id)s -{ - [s retain]; - [subpaths release]; - subpaths = s; -} - -- (unsigned int)countOfSubpaths -{ - return [[self subpaths] count]; -} - -- (PathNode *)objectInSubpathsAtIndex:(unsigned int)index -{ - return [[self subpaths] objectAtIndex:index]; -} - @end diff --git a/FileDrawer/FileOutlineView.h b/FileDrawer/FileOutlineView.h index 5e49b2679..f89bc66b5 100644 --- a/FileDrawer/FileOutlineView.h +++ b/FileDrawer/FileOutlineView.h @@ -8,9 +8,12 @@ #import +@class FileTreeDataSource; @interface FileOutlineView : NSOutlineView { IBOutlet NSDrawer *fileDrawer; + + FileTreeDataSource *dataSource; } @end diff --git a/FileDrawer/FileOutlineView.m b/FileDrawer/FileOutlineView.m index 0f6a26753..880510d6c 100644 --- a/FileDrawer/FileOutlineView.m +++ b/FileDrawer/FileOutlineView.m @@ -8,10 +8,13 @@ #import "FileOutlineView.h" #import "FileIconCell.h" +#import "FileTreeDataSource.h" + @interface FileOutlineView (KFTypeSelectTableViewSupport) - (void)findPrevious:(id)sender; - (void)findNext:(id)sender; +- (void)kfResetSearch; @end @implementation FileOutlineView @@ -22,13 +25,15 @@ id c; while ((c = [e nextObject])) { -// id headerCell = [[ImageTextCell alloc] init]; id dataCell = [[FileIconCell alloc] init]; [dataCell setLineBreakMode:NSLineBreakByTruncatingTail]; -// [c setHeaderCell: headerCell]; [c setDataCell: dataCell]; + NSLog(@"Setting data cell!"); } + + dataSource = [[FileTreeDataSource alloc] initWithRoot: [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileDrawerRootPath"] ]; + [self setDataSource: dataSource]; } @@ -59,7 +64,7 @@ [self kfResetSearch]; } else if (pressedChar == NSCarriageReturnCharacter || pressedChar == NSEnterCharacter) { //Enter or return //Add songs to list - [[self delegate] addSelectedToPlaylist]; + //[[self delegate] addSelectedToPlaylist]; [fileDrawer close]; } else if (pressedChar == 0x1b) {//Escape diff --git a/FileDrawer/FileTreeController.h b/FileDrawer/FileTreeController.h index cad5f8f93..6f6127156 100644 --- a/FileDrawer/FileTreeController.h +++ b/FileDrawer/FileTreeController.h @@ -20,8 +20,11 @@ FileTreeWatcher *watcher; } +- (FileTreeWatcher *)watcher; + - (id)rootPath; - (void)setRootPath:(id)r; -- (void) refreshRoot; +- (void)refreshRoot; +- (NSArray *)acceptableFileTypes; @end diff --git a/FileDrawer/FileTreeController.m b/FileDrawer/FileTreeController.m index 9a1b6b69c..745efa9e2 100644 --- a/FileDrawer/FileTreeController.m +++ b/FileDrawer/FileTreeController.m @@ -48,7 +48,7 @@ - (void) refreshRoot { DirectoryNode *base = [[DirectoryNode alloc] initWithPath:rootPath controller:self]; - [self setContent: [base subpaths]]; +// [self setContent: [base subpaths]]; [base release]; @@ -122,7 +122,7 @@ while (p = [e nextObject]) { int i; - PathNode *n = nil; + id n = nil; NSIndexPath *ip = [p indexPath]; for (i = 0; i < [ip length]; i++) diff --git a/FileDrawer/FileTreeWatcher.h b/FileDrawer/FileTreeWatcher.h index f80b4c70e..1b78ffd89 100644 --- a/FileDrawer/FileTreeWatcher.h +++ b/FileDrawer/FileTreeWatcher.h @@ -7,7 +7,8 @@ // #import -#import "UKKQueue.h" + +@class UKKQueue; @interface FileTreeWatcher : NSObject { UKKQueue *kqueue; diff --git a/FileDrawer/FileTreeWatcher.m b/FileDrawer/FileTreeWatcher.m index df34d58dd..d5d44d95b 100644 --- a/FileDrawer/FileTreeWatcher.m +++ b/FileDrawer/FileTreeWatcher.m @@ -8,6 +8,8 @@ #import "FileTreeWatcher.h" +#import "UKKQueue.h" + @implementation FileTreeWatcher - (id)init diff --git a/FileDrawer/PathIcon.h b/FileDrawer/PathIcon.h deleted file mode 100644 index b30d4269d..000000000 --- a/FileDrawer/PathIcon.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// FileIcon.h -// Cog -// -// Created by Vincent Spader on 8/20/06. -// Copyright 2006 Vincent Spader. All rights reserved. -// - -#import - - -@interface PathIcon : NSObject { - NSString *path; - NSImage *icon; -} - --(id)initWithPath:(NSString *)p; - -@end diff --git a/FileDrawer/PathIcon.m b/FileDrawer/PathIcon.m deleted file mode 100644 index 59e19f67b..000000000 --- a/FileDrawer/PathIcon.m +++ /dev/null @@ -1,44 +0,0 @@ -// -// FileIcon.m -// Cog -// -// Created by Vincent Spader on 8/20/06. -// Copyright 2006 Vincent Spader. All rights reserved. -// - -#import "PathIcon.h" - - -@implementation PathIcon - --(id)initWithPath:(NSString *)p -{ - self = [super init]; - if (self) - { - path = [p retain]; - icon = [[[NSWorkspace sharedWorkspace] iconForFile:path] retain]; - - [icon setSize: NSMakeSize(16.0, 16.0)]; - } - - return self; -} - -- (void)dealloc -{ - [path release]; - [icon release]; -} - -- (NSString *) path -{ - return path; -} - -- (NSImage *) icon -{ - return icon; -} - -@end diff --git a/FileDrawer/PathNode.h b/FileDrawer/PathNode.h index 906764e5b..dc6e1e5c1 100644 --- a/FileDrawer/PathNode.h +++ b/FileDrawer/PathNode.h @@ -7,17 +7,27 @@ // #import -#import "PathIcon.h" @interface PathNode : NSObject { NSString *path; - PathIcon *pathIcon; + NSImage *icon; + + NSArray *subpaths; } - (id)initWithPath:(NSString *)p; -- (id)pathIcon; -- (void)setPathIcon:(id)pi; +- (NSString *)path; +- (void)setPath:(NSString *)p; + +- (void)processPaths: (NSArray *)contents; + +- (NSArray *)subpaths; +- (void)setSubpaths:(NSArray *)s; + +- (NSImage *)icon; + +- (BOOL)isLeaf; @end diff --git a/FileDrawer/PathNode.m b/FileDrawer/PathNode.m index 9ac6fd626..6269a69f0 100644 --- a/FileDrawer/PathNode.m +++ b/FileDrawer/PathNode.m @@ -8,6 +8,12 @@ #import "PathNode.h" +#import "CogAudio/AudioPlayer.h" + +@class FileNode; +@class DirectoryNode; +@class SmartFolderNode; + @implementation PathNode - (id)initWithPath:(NSString *)p @@ -16,8 +22,7 @@ if (self) { - path = [p retain]; - [self setPathIcon:[[PathIcon alloc] initWithPath:path]]; + [self setPath: p]; } return self; @@ -26,26 +31,105 @@ - (void)dealloc { [path release]; - [pathIcon release]; - + [icon release]; + + if (subpaths) { + [subpaths release]; + subpaths = nil; + } + [super dealloc]; } +- (void)setPath:(NSString *)p +{ + [p retain]; + [path release]; + + path = p; + + [icon release]; + icon = [[NSWorkspace sharedWorkspace] iconForFile:path]; + [icon retain]; + + [icon setSize: NSMakeSize(16.0, 16.0)]; +} + - (NSString *)path { return path; } -- (id)pathIcon +- (void)processPaths: (NSArray *)contents { - return pathIcon; + NSMutableArray *newSubpaths = [[NSMutableArray alloc] init]; + + NSEnumerator *e = [contents objectEnumerator]; + NSString *s; + while ((s = [e nextObject])) + { + if ([s characterAtIndex:0] == '.') + { + continue; + } + + PathNode *newNode; + NSString *newSubpath = [path stringByAppendingPathComponent: s]; + + if ([[s pathExtension] caseInsensitiveCompare:@"savedSearch"] == NSOrderedSame) + { + newNode = [[SmartFolderNode alloc] initWithPath:newSubpath]; + } + else + { + BOOL isDir; + + [[NSFileManager defaultManager] fileExistsAtPath:newSubpath isDirectory:&isDir]; + + if (!isDir && ![[AudioPlayer fileTypes] containsObject:[s pathExtension]]) + { + continue; + } + + if (isDir) + newNode = [[DirectoryNode alloc] initWithPath: newSubpath]; + else + newNode = [[FileNode alloc] initWithPath: newSubpath]; + } + + [newSubpaths addObject:newNode]; + + [newNode release]; + } + + [self setSubpaths:[[newSubpaths copy] autorelease]]; + + [newSubpaths release]; } -- (void)setPathIcon:(id)pi +- (NSArray *)subpaths { - [pi retain]; - [pathIcon release]; - pathIcon = pi; + return subpaths; } +- (void)setSubpaths:(NSArray *)s +{ + [s retain]; + [subpaths release]; + subpaths = s; +} + + +- (BOOL)isLeaf +{ + return YES; +} + + +- (NSImage *)icon +{ + return icon; +} + + @end diff --git a/FileDrawer/SmartFolderNode.h b/FileDrawer/SmartFolderNode.h index f5cab29eb..35b59f840 100644 --- a/FileDrawer/SmartFolderNode.h +++ b/FileDrawer/SmartFolderNode.h @@ -11,8 +11,6 @@ #import "PathNode.h" @interface SmartFolderNode : PathNode { - NSMutableArray *subpaths; - id controller; } @end diff --git a/FileDrawer/SmartFolderNode.m b/FileDrawer/SmartFolderNode.m index dd61d32d3..d6c6c1e00 100644 --- a/FileDrawer/SmartFolderNode.m +++ b/FileDrawer/SmartFolderNode.m @@ -12,77 +12,15 @@ @implementation SmartFolderNode --(id)initWithPath:(NSString *)p controller:(id) c -{ - self = [super initWithPath:p]; - if (self) - { - controller = [c retain]; - } - - return self; -} - -- (void)dealloc { - if (subpaths) - [subpaths release]; - - [super dealloc]; -} - - - (BOOL)isLeaf { return NO; } -//need to merge this and directorynode -- (void)processContents: (NSArray *)contents -{ - NSEnumerator *e = [contents objectEnumerator]; - NSString *s; - - while (s = [e nextObject]) - { -/* if ([s characterAtIndex:0] == '.') - { - continue; - } -*/ - PathNode *newNode; -// NSString *newSubpath = [path stringByAppendingPathComponent: s]; - - if ([[s pathExtension] caseInsensitiveCompare:@"savedSearch"] == NSOrderedSame) - { - newNode = [[SmartFolderNode alloc] initWithPath:s controller:controller]; - } - else - { - BOOL isDir; - - [[NSFileManager defaultManager] fileExistsAtPath:s isDirectory:&isDir]; - - if (!isDir && ![[controller acceptableFileTypes] containsObject:[s pathExtension]]) - continue; - - if (isDir) - newNode = [[DirectoryNode alloc] initWithPath: s controller:controller]; - else - newNode = [[FileNode alloc] initWithPath: s]; - } - - [subpaths addObject:newNode]; - - [newNode release]; - } -} - - (NSArray *)subpaths { if (subpaths == nil) { - subpaths = [[NSMutableArray alloc] init]; - NSDictionary *doc = [NSDictionary dictionaryWithContentsOfFile:path]; NSString *rawQuery = [doc objectForKey:@"RawQuery"]; NSArray *searchPaths = [[doc objectForKey:@"SearchCriteria"] objectForKey:@"CurrentFolderPath"]; @@ -120,7 +58,7 @@ - (void)queryFinished:(NSNotification *)notification { - MDQueryRef query = [notification object]; + MDQueryRef query = (MDQueryRef)[notification object]; NSMutableArray *results = [NSMutableArray array]; @@ -141,13 +79,11 @@ MDQueryEnableUpdates(query); - [self processContents:results]; - [self setSubpaths:subpaths]; + [self processPaths:results]; } - (void)queryUpdate:(NSNotification *)notification { - [subpaths removeAllObjects]; [self queryFinished: notification]; }