Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Bug - path_sort doesn't always give expected results (Read 467 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Bug - path_sort doesn't always give expected results

This is likely a very old bug with %path_sort%. I tested on v2.1 preview x86 and v1.6.16.

When sorting by %path_sort% (Preferences > Shell Integration > Sort incoming files by:), sometimes the results are different from what you would expect based on the order of folders in Windows and the order of Folders in Album List Panel (Columns UI - view by directory structure)

I have a couple old CDs from the 90s called Pure Moods and Pure Moods II. In both Windows and in the Album List Panel, the order they appear is:
Pure Moods
Pure Moods II

However, when you add by the folder these subfolders are both in, %path_sort% will put all tracks from Pure Moods II before Pure Moods. I don't know exactly why this occurs, but if I were to hazard a guess I would think it has something to do with the %path% string.

I will add a screenshot showing what I mean, but it looks like
"F:\music\New Age\Pure Moods II\16 - The Mystic's Dream.flac"
comes alphabetically before
"F:\music\New Age\Pure Moods\01 - Return to Innocence.flac"

I think the problem might be that %path_sort% puts spacebar before backslash alphabetically. I'm not certain, but this is my best guess. Regardless, it is still sorting them on the playlist out of the expected order.

I apologize if this has been covered before, but I tried search and couldn't find a bug report regarding this. Thank you!

I forgot to mention that I sorted by the final column in the screenshot which displays "%path%" (nothing more) and it puts everything in the same order, or reverse when I click a second time, which seems to support my earlier guess.
Think millionaire, but with cannons.


Re: Bug - path_sort doesn't always give expected results

Reply #2
This isn't bug. This is feature. Problem is as old as foobar2000 itself.,68266.0.html,91480.0.html

Thanks for the reply! I indeed found a solution to my problem there. However, the issues reported in those posts are fundamentally different from what I reported, and here is how:

In those threads, they were dissatisfied with the "by directory structure" view in the Album List Panel. I am content with "by directory structure" in that panel and it is not an issue for me.

The bug I am reporting is about how things get sorted when you add them to a playlist (with %path_sort%), as well as how they are sorted when you sort with a "%path%" column. With each of those, sometimes you will not get the expected results as files from folder "\Pure Moods II\" will be sorted before "\Pure Moods\", even though the system should logically put the shorter version with no " II" first.

The workaround I found is to replace "%path_sort%" in "Preferences > Shell Integration > Sort incoming files by:" with the following script:
Code: [Select]
$replace($directory_path($substr(%path%,4,999)),\, | $char(8226)  ) | $char(8226) %filename_ext%

I also made a column with that as the script  in case I want to sort that way, as sorting with a %path% column still doesn't work properly in all cases.

To sum up:
I believe there is still a bug, but "I got mine" as they say. I have a workaround that works for me. Thank you for the help!
Think millionaire, but with cannons.