Re: [Q] Directory & File enumeration order?
Re: [Q] Directory & File enumeration order?
- Subject: Re: [Q] Directory & File enumeration order?
- From: Jens Alfke <email@hidden>
- Date: Wed, 20 Jul 2011 15:28:02 -0700
On Jul 20, 2011, at 2:09 PM, JongAm Park wrote:
> How can I make it retrieve in this order?
>
> Clip_0016_000000.dpx,
> Clip_0016_000001.dpx,
> Clip_0016_000002.dpx,
I don’t think you can. In general, file systems do not have to store directory contents sorted by name. It happens that HFS+ does, but other common filesystems like FAT and SMB don’t. And the API isn’t going to do extra work to sort the filenames for you, because these enumeration APIs are often performance bottlenecks (when run over entire filesystems) and need to be fast.
> Yeah.. that was what I thought, but I thought "nextObject" is too vague and doing that additional step is too time-consuming, because I need to work on contents in directories in my current project very frequently.
Have you actually benchmarked and determined that doing the sorting is too slow, or are you just guessing? Guesses about performance are very often wrong. The evidence from many UIs that show directory contents in sorted order (Finder, NSOpenPanel, etc.) is that this isn’t noticeably slow.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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