1
0

Implemented lazy load of platform specific functionallity, and a different test for that functionallity.

This commit is contained in:
Jon Michael Aanes 2018-01-09 13:29:15 +01:00
parent 81626f6b1e
commit 9b284ee2ce

View File

@ -56,10 +56,13 @@ local function package_config ()
} }
end end
local iterate_files_in_subfiles local iterate_files_in_subfiles = function (...)
-- This outer function is a wrapper, that lazily loads the correct
-- version of the iterate function, based on the availability of
-- the commands.
if package_config().dir_sep == '/' then if os.execute 'find -false' == 0 then
function iterate_files_in_subfiles (root_path) iterate_files_in_subfiles = function (root_path)
-- On unix -- On unix
-- Use `find` to find files in folders below the given matching. -- Use `find` to find files in folders below the given matching.
@ -71,9 +74,14 @@ if package_config().dir_sep == '/' then
return list_str:gmatch '[^%z]+' return list_str:gmatch '[^%z]+'
end end
else else
-- On windows -- Other platforms
error '[suggest-require]: Windows is not currently supported.' error '[suggest-require]: Your platform does not possess the "find" utility, and is thus not currently supported.'
end
-----
return iterate_files_in_subfiles(...)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -199,7 +207,7 @@ local function get_available_module_names ()
for name in pairs(dedub) do module_names[#module_names+1] = name end for name in pairs(dedub) do module_names[#module_names+1] = name end
table.sort(module_names) table.sort(module_names)
-- Output assertions -- Assert that output is correctly formatted
assert(type(module_names) == 'table') assert(type(module_names) == 'table')
for i = 1, #module_names do for i = 1, #module_names do
assert(type(module_names[i]) == 'string') assert(type(module_names[i]) == 'string')