aldostools / IRISMAN

All-in-one backup manager for PlayStation®3. Fork of Iris Manager.
GNU General Public License v3.0
227 stars 22 forks source link

Question about sorting order and ‘..’ #91

Open ghost opened 1 year ago

ghost commented 1 year ago

Is there any way of guaranteeing that ‘..’ is always the first option? It would greatly simplify a lot of checks in exFAT Manager, and fix a “bug” that exists in the native file manager as well.

This would be an extremely rare occurrence, but if the user has any file/folder name that starts with a character sorted before ’.’ (or less than 2E), it will be above ‘..’

Masamune3210 commented 1 year ago

On most, if not all modern filesystems, the . and .. directories arent actually there, they are virtual and only exist as concepts inside of programs that understand them. Think of them as shortcuts, they arent actually anything, just something to help you do something else easier. If this is the case, I would assume that they are not even considered as part of the sort list and its probably safe to assume that they will always be at the top of the list

ghost commented 1 year ago

On most, if not all modern filesystems, the . and .. directories arent actually there, they are virtual and only exist as concepts inside of programs that understand them. Think of them as shortcuts, they arent actually anything, just something to help you do something else easier. If this is the case, I would assume that they are not even considered as part of the sort list and its probably safe to assume that they will always be at the top of the list

Unfortunately that isn’t the case here. If the user has a folder named (for example) !test, it will be above ’..’. 99% of the time it won’t be an issue. But I’d like to know if aldo can help fix this before I do anything else. Long story short, if this can be fixed, I can check if the current option is 1, otherwise I need to check the current option is actually ’..’ (which is more code).

aldostools commented 1 year ago

As that is a rare case, it can use a normal sort.

Another way is to exclude or remove .. before sort the list. Then add .. to the beginning of the linked list after sort it.