Skip to content

Commit cbeabbd

Browse files
edolstraoxij
authored andcommitted
Sort sessions in dictionary order
Previously, it used directory order, which can be arbitrary. Adapted from NixOS/nixpkgs@eeb9231
1 parent 2c08533 commit cbeabbd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cfg.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* (at your option) any later version.
1111
*/
1212

13+
#include <algorithm>
1314
#include <fstream>
1415
#include <iostream>
1516
#include <stdlib.h>
@@ -361,6 +362,11 @@ void Cfg::fillSessionList()
361362
}
362363
}
363364

365+
std::sort(sessions.begin(), sessions.end(),
366+
[](pair<string, string> & a, pair<string, string> & b) -> bool {
367+
return a.first < b.first;
368+
});
369+
364370
if (sessions.empty()) {
365371
if (strSessionList.empty()) {
366372
pair<string, string> session("", "");

0 commit comments

Comments
 (0)