Cocoa 递归目录遍历
我试图在Objective C中遍历一个目录。我可以在Java中这样做,但在Objective C中如何做到这一点却让我困惑。我正在使用XCode5,并试图远离C++/C 我有一些,但到目前为止,我遗漏了一些东西Cocoa 递归目录遍历,cocoa,Cocoa,我试图在Objective C中遍历一个目录。我可以在Java中这样做,但在Objective C中如何做到这一点却让我困惑。我正在使用XCode5,并试图远离C++/C 我有一些,但到目前为止,我遗漏了一些东西 - (IBAction)buttonPush:(id)sender { NSLog(@"Button Pushed"); NSOpenPanel* panel = [NSOpenPanel openPanel]; [panel setCanChooseDi
- (IBAction)buttonPush:(id)sender {
NSLog(@"Button Pushed");
NSOpenPanel* panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:YES];
// [panel setAllowsMultipleSelection:YES]; // not now
[panel setMessage:@"Select one or more, files or directories."];
[panel beginWithCompletionHandler:^(NSInteger result){
NSLog(@"OPEN Pushed");
if (result == NSFileHandlingPanelOKButton) {
NSArray* urls = [panel URLs];
[self parseArray:urls]; *// How do I use the URL?NSURL?
// Need to know if selected is File or Directory.
// If File, what is the file attributes
// If Directory, list the contents of the directory: procedure to recursively handle*
}
签出
-[NSFileManager枚举器URL:includingPropertiesForKeys:options:errorHandler:][/code>。苹果的文档,包括一些示例代码,是。从开始。你需要的一切都在那里。