[rygel] core: Sort files while loading modules
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Sort files while loading modules
- Date: Sun, 22 May 2022 09:15:02 +0000 (UTC)
commit 1ca04f27d3f8acdd02c1a95079f9506c879ece30
Author: Jens Georg <mail jensge org>
Date: Sun May 8 19:50:08 2022 +0200
core: Sort files while loading modules
Fixes #173
src/librygel-core/rygel-recursive-module-loader.vala | 11 +++++++++++
1 file changed, 11 insertions(+)
---
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 (),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]