Re: paths for contents of a directory
Re: paths for contents of a directory
- Subject: Re: paths for contents of a directory
- From: Roland Silver <email@hidden>
- Date: Mon, 14 May 2007 23:06:03 -0600
On Tue, 15 May 2007 00:38:19 -0400 Eric Jutras wrote:
-------------------------
From: Eric Jutras <email@hidden>
Subject: Re: paths for contents of a directory
To: Roland Silver <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Have you tried NSFileManager's
- (NSDirectoryEnumerator *)enumeratorAtPath:(NSString *)path
?
On 15 mai 07, at 00:32, Roland Silver wrote:
Given a string directoryPath which is a path to a directory, is
there some simple way to iterate over the members of the directory
which yields not just the file name of the member, but its complete
path name?
With this code:
NSArray* directoryContents =
[[NSFileManager defaultManager]
directoryContentsAtPath:directoryPath];
NSString* path;
NSEnumerator *enumerator = [directoryContents objectEnumerator];
while (path = [enumerator nextObject]) {
...
}
the variable "path" (surprisingly) is bound to the file names of
the successive entries of the directory, rather than to their path
names -- which are what I need to extract the contents of the files
in the directory.
------------------------
Yes, I did try enumeratorAtPath, with the same result: it produces
file names, not complete paths.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden