From dd8d607cd77677f509304bba1737664243a89fd0 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad <hisham@gobolinux.org> Date: Sun, 14 Aug 2011 13:45:51 -0300 Subject: Abstract away configuration issue over to cfg. --- src/luarocks/cfg.lua | 6 ++++++ src/luarocks/path.lua | 10 ++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 25f22e26..ace0dbf1 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -190,6 +190,8 @@ if detected.windows then lib = { "?.dll", "lib?.dll" }, include = { "?.h" } } + defaults.export_lua_path = "SET LUA_PATH=%s" + defaults.export_lua_cpath = "SET LUA_CPATH=%s" defaults.local_cache = home.."/cache/luarocks" end @@ -223,6 +225,8 @@ if detected.mingw32 then lib = { "?.dll", "lib?.dll" }, include = { "?.h" } } + defaults.export_lua_path = "SET LUA_PATH=%s" + defaults.export_lua_cpath = "SET LUA_CPATH=%s" defaults.local_cache = home.."/cache/luarocks" end @@ -251,6 +255,8 @@ if detected.unix then lib = { "lib?.so", "lib?.so.*" }, include = { "?.h" } } + defaults.export_lua_path = "export LUA_PATH='%s'" + defaults.export_lua_cpath = "export LUA_CPATH='%s'" defaults.local_cache = home.."/.cache/luarocks" if not defaults.variables.CFLAGS:match("-fPIC") then defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC" diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index 83b84530..fe241aa5 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua @@ -302,16 +302,10 @@ function versioned_name(file, prefix, name, version) end --- Driver function for "path" command. --- This platform distinction is not in fs to avoid depending on that module here. -- @return boolean This function always succeeds. function run(...) - if cfg.is_platform("unix") then - util.printout("export LUA_PATH='"..package.path.."'") - util.printout("export LUA_CPATH='"..package.cpath.."'") - elseif cfg.is_platform("windows") then - util.printout("SET LUA_PATH="..package.path) - util.printout("SET LUA_CPATH="..package.cpath) - end + util.printout(cfg.export_lua_path:format(package.path)) + util.printout(cfg.export_lua_cpath:format(package.path)) return true end -- cgit v1.2.3-55-g6feb