Sub Main
path = "~/test/"
myFile = Dir(path & "*")
While myFile <> ""
url = ConvertToUrl(path & myFile)
result = result + url + chr(10)
myFile = Dir
Wend
msgbox result
End Sub
The result is sorted non alphabetically.
Tested with AOO 4.1.1 and Debian 7 x64
Could you confirm the bug?
Last edited by Bidouille on Thu Mar 19, 2015 11:30 am, edited 1 time in total.
This is not a bug. The order of files queried from the file system is up to the file system. If you want a sorted list then sort it.
Same with this code:
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
@Bidouille: I think you need to look at the file save time seconds to get the exact order of the sorted files. In your screenshot Chat398.jpg, chat401.jpg and chat002.jpg are all shown with date/time of 16/03/2015 15:58, but they may all differ in the seconds place, which you do not display but which a time based sort will take into account.
As Villeroy points out, it is logical that your subroutine returns the files in the order the operating system filehandler sees them. Unless there are API parameters to cause a directory query to be returned in sorted order (I don't know - I haven't looked), your best approach may be to read the directory names into an array and call a sort routine.