summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2022-05-08 19:50:08 +0200
committerJens Georg <mail@jensge.org>2022-05-22 11:13:50 +0200
commit1ca04f27d3f8acdd02c1a95079f9506c879ece30 (patch)
treed264bc95117ece27c2f6176e360ee2071ed4f4b7 /src
parent4bf83d1ea69b2a40c7e29deb5eef310c24644d24 (diff)
downloadrygel-1ca04f27d3f8acdd02c1a95079f9506c879ece30.tar.gz
core: Sort files while loading modules
Fixes #173
Diffstat (limited to 'src')
-rw-r--r--src/librygel-core/rygel-recursive-module-loader.vala11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librygel-core/rygel-recursive-module-loader.vala b/src/librygel-core/rygel-recursive-module-loader.vala
index 009eadaf..1e0e2bdb 100644
--- a/src/librygel-core/rygel-recursive-module-loader.vala
+++ b/src/librygel-core/rygel-recursive-module-loader.vala
@@ -145,6 +145,17 @@ public abstract class Rygel.RecursiveModuleLoader : Object {
infos = yield enumerator.next_files_async (int.MAX,
Priority.DEFAULT,
null);
+ infos.sort((info_a, info_b) => {
+ var type_a = info_a.get_file_type ();
+ var type_b = info_b.get_file_type ();
+
+ if (type_a != type_b) {
+ if (type_a == FileType.DIRECTORY) return -1;
+ if (type_b == FileType.DIRECTORY) return 1;
+ }
+
+ return strcmp (info_a.get_name (), info_b.get_name ());
+ });
} catch (Error error) {
critical (_("Error listing contents of folder ā€œ%sā€: %s"),
folder.get_path (),