目录的Cocoa内容 [英] Cocoa contents of directory

查看:114
本文介绍了目录的Cocoa内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一系列文本文件的组/文件夹。我需要为每一个路径,以便我可以阅读的内容,但我似乎不能得到任何工作。

I have a group/folder with a series of text files. I need to get a path for each one so that I can read the contents, but I can't seem to get anything to work.

我已经使用 [NSBundle pathsForResourcesOfType:@txtinDirectory:@directoryName] 给我一个null或一个字符串读取内容, [[NSFileManager defaultManager] enumeratorAtPath:@directoryName] ,我不知道该怎么做它被创建,并且 [[NSFileManager defaultManager] contentOfDirectoryAtPath:@directoryNameerror:nil]

I've mucked about with [NSBundle pathsForResourcesOfType:@"txt" inDirectory:@"directoryName"] which gave me nothing but nulls or a single string that reads "Contents", [[NSFileManager defaultManager] enumeratorAtPath:@"directoryName"] which I have no idea what to do with once it's created, and [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"directoryName" error:nil].

我不知道我做错了什么,在这一点上我只是在吸管。我在这里经历了20或30页,没有一个真正帮助。

I can't figure out what I'm doing wrong, and at this point I'm just grasping at straws. I went through 20 or 30 pages on here, none of which has really helped.

我应该注意这是一个Cocoa应用程序,而不是iOS。

I should note that this is a Cocoa Application, not iOS.

推荐答案

问题是,当添加文件夹时,我需要创建一个对文件夹的引用。 Xcode不默认使用此选项。我最初选择简单地创建组,这不工作。

The problem was that when adding the folder, I needed to create a reference to the folder as well. Xcode does not default to this option. I had initially chosen to simply create groups, and this does not do the job.

这篇关于目录的Cocoa内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆