This is from the unreal engine, it’s not standard behavior for the engine and i’ve noticed that certain other applications sometimes behave this way too (notably the ls
command for instance).
Anyone know what causes this and how I can fix it?
This is from the unreal engine, it’s not standard behavior for the engine and i’ve noticed that certain other applications sometimes behave this way too (notably the ls
command for instance).
Anyone know what causes this and how I can fix it?
that’s a neat trick, but i was talking about fixing this weird (seemingly) default system behavior.
This is why I often name files that I am numbering 001 etc depending on the amount of files in the directory
EDIT I’ve never bothered questioning to why it does it this way, it makes sense to me enough
It doesn’t make sense and i don’t think any file manager defaults to this, unless it uses the system settings for sorting and the system settings tells them to, as far as I know this issue only really exists on Linux.
It can also be potentially damaging, for instance say there’s a program that expects files named with numbers to actually be sorted correctly by the system, like say fetching all files in a folder and loading them into an array. Because of this weirdness, those programs would either need to account for this possibility which complicates the mechanism for this quite a bit, or somehow forcefully override the default system file sorting with a sensible one; it also means if the author didn’t do so because say they were developing in python on windows or something, that software would be broken on most linux machines because of this eccentricity.
This is actually a very bad thing (if wine doesn’t have some workaround for this issue this could potentially be a cause for many things not working on wine).
A web search suggested setting LC_COLLATE=C
would fix this but… It doesn’t seem to do anything.
Makes sense to me in the way a will be followed by b 1 will be followed by 2, since it isn’t reading the whole word I think it sorts character by character then works out what should be before what. (Sorry if that is hard to understand, thing like this my brain just seems to say ok yes and explaining further I struggle with)
Yes, it’s sorting by initial character, and 1 does come before 2. How I fix this is adding a leading zero. This is a common issue in Excel (and other spreadsheet apps). Unless you specify the cells as Numbers, it will sort them as 1, 10, 11, 12, 2, 3, 4, 5 etc.
Windows sorts numbers identically to Linux. I have never used a computer in the last fifty years that did not sort numbers this way. If I list a directory in Windows, 10 always comes after 1, 20 comes after 2, 30 comes after 3, and so on and so forth. Using leading zeros has always been the way to “solve” this situation. I say solve because its not a problem, that is just the way computers sort numbers.
This is not number sorting. Those are just digits within an alphanumerical string. And therefore they are sorted alphanumerical.
It is ultimately up to the application to decide how to sort things.
Some applications will understand that the beginning is a number and do a numeric sort and others won’t. Some have options to let you choose how you want to sort numbers.
I don’t think there is a universal fix for it.
I see, I didn’t know this, I just saw someone on windows in unreal name his folders this way and they were correctly sorted unlike mine, I guess I might be wrongly assuming it was a linux issue.
I’ve been naming docs, files and folders starting with 01
instead of 1
for decades. For this very reason.
I’m late in this, but you can check if there’s a space before the 10, quite often the app/system sees that as a 1 as well, only the 1 that doesn’t have a space in front of it, will come first.
If there is a space before it and you remove it, mostly the 10 will come after the 9, at least that was the case over here.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.