Implemented lazy load of platform specific functionallity, and a different test for that functionallity.
This commit is contained in:
parent
81626f6b1e
commit
9b284ee2ce
|
@ -56,10 +56,13 @@ local function package_config ()
|
|||
}
|
||||
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
|
||||
function iterate_files_in_subfiles (root_path)
|
||||
if os.execute 'find -false' == 0 then
|
||||
iterate_files_in_subfiles = function (root_path)
|
||||
-- On unix
|
||||
-- Use `find` to find files in folders below the given matching.
|
||||
|
||||
|
@ -72,8 +75,13 @@ if package_config().dir_sep == '/' then
|
|||
return list_str:gmatch '[^%z]+'
|
||||
end
|
||||
else
|
||||
-- On windows
|
||||
error '[suggest-require]: Windows is not currently supported.'
|
||||
-- Other platforms
|
||||
error '[suggest-require]: Your platform does not possess the "find" utility, and is thus not currently supported.'
|
||||
end
|
||||
|
||||
-----
|
||||
|
||||
return iterate_files_in_subfiles(...)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -199,7 +207,7 @@ local function get_available_module_names ()
|
|||
for name in pairs(dedub) do module_names[#module_names+1] = name end
|
||||
table.sort(module_names)
|
||||
|
||||
-- Output assertions
|
||||
-- Assert that output is correctly formatted
|
||||
assert(type(module_names) == 'table')
|
||||
for i = 1, #module_names do
|
||||
assert(type(module_names[i]) == 'string')
|
||||
|
|
Loading…
Reference in New Issue
Block a user