2006-09-02 12:09:20 -04:00
|
|
|
//
|
|
|
|
// DirectoryNode.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 8/20/2006.
|
|
|
|
// Copyright 2006 Vincent Spader. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "DirectoryNode.h"
|
2007-10-14 20:24:54 -03:00
|
|
|
|
2006-09-02 12:09:20 -04:00
|
|
|
#import "FileNode.h"
|
2006-09-26 18:22:56 -04:00
|
|
|
#import "SmartFolderNode.h"
|
2006-09-02 12:09:20 -04:00
|
|
|
|
2018-06-28 06:59:59 -04:00
|
|
|
#import "NSString+FinderCompare.h"
|
|
|
|
|
2007-10-14 20:24:54 -03:00
|
|
|
@implementation DirectoryNode
|
2006-09-02 12:09:20 -04:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (BOOL)isLeaf {
|
2006-09-02 12:09:20 -04:00
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)updatePath {
|
2022-06-29 03:31:34 -04:00
|
|
|
if(!url) return;
|
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url
|
|
|
|
includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]
|
|
|
|
options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles)
|
|
|
|
errorHandler:^BOOL(NSURL *url, NSError *error) {
|
|
|
|
return NO;
|
|
|
|
}];
|
2007-10-15 20:18:58 -03:00
|
|
|
NSMutableArray *fullPaths = [[NSMutableArray alloc] init];
|
2008-02-19 21:54:45 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
for(NSURL *theUrl in enumerator) {
|
2013-10-03 05:00:58 -03:00
|
|
|
[fullPaths addObject:[theUrl path]];
|
2007-10-15 20:18:58 -03:00
|
|
|
}
|
2007-10-15 00:29:30 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
[self processPaths:[fullPaths sortedArrayUsingSelector:@selector(finderCompare:)]];
|
2006-09-02 12:09:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|