Order of Folderitem.items

I have always expected the order of a folderitem’s children to be alphabetic
I have a customer who says that when listing a folder’s contents, the files are random.
Is this expected?
Can the order of the collection of children be co-erced or must I apply some kind of sort before use ?

A quote of another Forum Thread:

[quote]@Christian Schmitz: The order is not guaranteed.
MacOS used to return them sorted, but that is not done for APFS.
But you can put them in an array as well as their names and use Array.SortWith function.[/quote]

Hurrah. Another useful new ‘feature’ in OSX

Thanks for the confirmation Jürg.

I have a 3rd party app written using another programing language. It uses a tree view that displays folderitems based on their index while the files are shown in alphabetical order within the Finder.

Is there any way to alter the index of folderitem children using Xojo so that their index number equals their sort order?

Much as the answer to my query, the ‘index of’ a file is not certain.
It’s purely a method by which you can iterate through files in Xojo.

Users do not care about an arbitrary index number.

If you want to display files in a certain order in your app, sort the filename into that order before filling the treeview.
Add each folderitem to the rowtag of each line so that you can get at the file quickly when user selects a row (but check the file is still valid … eg still .exists before you act upon it)

Glad I saw this thread! Until now both on mac (I was not using APFS until a couple of weeks ago!) and Windows they were returned in alphabetical order so I never thought about order unless I wanted them sorted by date!

  • Karen