APFS and Hirearchical filename listbox

Hi All,

I know there are other threads about APFS but they do not seem to address this issue directly.

I apologise if this issue should have been posted elsewhere.

I have an app which plays and animates midi files. The user is allowed to select from a hierarchical listbox of files and folders to build a play list. For years, the list has displayed files/folders in alphabetical order. I “upgraded” to High Sierra and suddenly, the list was displayed in an apparently random order.

Cutting a long story short, I found some small print saying that under APFS, files/folders are retrieved in hash order and not lexicographical(alphabetical) order (as with HFS+). Installing High Sierra had made my filing system APFS with unforeseen consequences.

In my case there is an easy solution - sort the filenames after loading.

This is just to warn other users of Xojo.

But - please anyone - correct me if I have made a wrong conclusion. And perhaps let me know if there is any other solution for the long term - especially for others where a simple sort may not produce the correct results. And are there any other consequences?

Bill

Is a Xojo sort encoding aware? What about Unicode (precomposed vs. decomposed etc)? I’m totally sure that the Xojo sort doesn’t do natural sort (thing 1, thing 2, thing 10, thing 11). This really depends on your filenames.

[quote=358459:@William Atherton]I have an app which plays and animates midi files. The user is allowed to select from a hierarchical listbox of files and folders to build a play list. For years, the list has displayed files/folders in alphabetical order. I “upgraded” to High Sierra and suddenly, the list was displayed in an apparently random order.

Cutting a long story short, I found some small print saying that under APFS, files/folders are retrieved in hash order and not lexicographical(alphabetical) order (as with HFS+). Installing High Sierra had made my filing system APFS with unforeseen consequences.

In my case there is an easy solution - sort the filenames after loading.

This is just to warn other users of Xojo.

But - please anyone - correct me if I have made a wrong conclusion. And perhaps let me know if there is any other solution for the long term - especially for others where a simple sort may not produce the correct results. And are there any other consequences?[/quote]

There’s never been a guarantee that FolderItem iteration is sorted by name.

Hi Beatrix - first, thanks for your script for deleting debug.app.

I would guess that if a custom sort is required, developers would already have implemented it - so need to worry.

Hi Joe

I understand - but there may be many like me who made the assumption of “alphabetic” retrieval and will need to take action.

Sorry - NO need to worry

Take a look at .sortWith in the documentation… It allows you to sort an array of objects, from an array of numbers or strings.