From 8996f79edbf4286807d5255b6db68550aa473951 Mon Sep 17 00:00:00 2001 From: Alexis Nootens Date: Tue, 2 Feb 2016 19:28:33 +0100 Subject: TOOLS/lua/autoload.lua: remove the extension prior to sort When the directory contains files named such as xx-14.ext and xx-14.5.ext, remove the extension to sort the table to load the 14 before the 14.5. --- TOOLS/lua/autoload.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'TOOLS/lua') diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index 0c8c9a5381..1f22bb40e2 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -72,6 +72,11 @@ function find_and_add_entries() return EXTENSIONS[string.lower(ext)] end) table.sort(files, function (a, b) + local len = string.len(a) - string.len(b) + if len ~= 0 then -- case for ordering filename ending with such as X.Y.Z + local ext = string.len(get_extension(a)) + 1 + return string.sub(a, 1, -ext) < string.sub(b, 1, -ext) + end return string.lower(a) < string.lower(b) end) -- cgit v1.2.3