diff options
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r-- | src/luarocks/cfg.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 8706bd60..261411b7 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | local rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package, type = | 2 | local rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package, type, assert = |
3 | rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package, type | 3 | rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package, type, assert |
4 | 4 | ||
5 | --- Configuration for LuaRocks. | 5 | --- Configuration for LuaRocks. |
6 | -- Tries to load the user's configuration file and | 6 | -- Tries to load the user's configuration file and |
@@ -318,7 +318,6 @@ local cfg_mt = { | |||
318 | } | 318 | } |
319 | setmetatable(_M, cfg_mt) | 319 | setmetatable(_M, cfg_mt) |
320 | 320 | ||
321 | |||
322 | for _,tree in ipairs(rocks_trees) do | 321 | for _,tree in ipairs(rocks_trees) do |
323 | if type(tree) == "string" then | 322 | if type(tree) == "string" then |
324 | package.path = tree..lua_modules_path.."/?.lua;"..tree..lua_modules_path.."/?/init.lua;"..package.path | 323 | package.path = tree..lua_modules_path.."/?.lua;"..tree..lua_modules_path.."/?/init.lua;"..package.path |
@@ -330,3 +329,15 @@ for _,tree in ipairs(rocks_trees) do | |||
330 | end | 329 | end |
331 | end | 330 | end |
332 | 331 | ||
332 | --- Check if platform was detected | ||
333 | -- @param query string: The platform name to check. | ||
334 | -- @return boolean: true if LuaRocks is currently running on queried platform. | ||
335 | function is_platform(query) | ||
336 | assert(type(query) == "string") | ||
337 | |||
338 | for _, platform in ipairs(platforms) do | ||
339 | if platform == query then | ||
340 | return true | ||
341 | end | ||
342 | end | ||
343 | end | ||