Commit bf63ab5f7ecf213368f918bda2a173e40c962452

Thomas de Grivel 2024-10-29T16:26:59

load_directory: sort files before loading

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/kc3/0.1/kc3.facts b/lib/kc3/0.1/kc3.facts
index e2d5968..c321f50 100644
--- a/lib/kc3/0.1/kc3.facts
+++ b/lib/kc3/0.1/kc3.facts
@@ -336,7 +336,7 @@ replace {KC3.human_size, :symbol_value, fn (size) {
 add {KC3, :symbol, KC3.load_directory}
 replace {KC3.load_directory, :symbol_value, fn (dir) {
   if File.exists?(dir) && File.is_directory?(dir) do
-    files = File.list(dir)
+    files = List.sort(File.list(dir))
     List.each(files, fn (file) {
       if (! Str.starts_with?(file, ".")) do
         path = dir + file