Cog/FileTree/DirectoryNode.m
Christopher Snowhill 099588b7bd Restore the File Tree, now with a chooser button
Revert "Remove the file tree, as Sandbox does not permit"

This reverts commit 35400e1320.

This also changes how the File Tree choosing works.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-30 16:59:35 -07:00

40 lines
1.3 KiB
Objective-C

//
// DirectoryNode.m
// Cog
//
// Created by Vincent Spader on 8/20/2006.
// Copyright 2006 Vincent Spader. All rights reserved.
//
#import "DirectoryNode.h"
#import "FileNode.h"
#import "SmartFolderNode.h"
#import "NSString+FinderCompare.h"
@implementation DirectoryNode
- (BOOL)isLeaf {
return NO;
}
- (void)updatePath {
if(!url) return;
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url
includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]
options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles)
errorHandler:^BOOL(NSURL *url, NSError *error) {
return NO;
}];
NSMutableArray *fullPaths = [[NSMutableArray alloc] init];
for(NSURL *theUrl in enumerator) {
[fullPaths addObject:[theUrl path]];
}
[self processPaths:[fullPaths sortedArrayUsingSelector:@selector(finderCompare:)]];
}
@end