# HG changeset patch # User Daniel Poelzleithner # Date 1284852968 -7200 # Node ID ea2e8f3a2776e1bd4c394f12200117b5b39b8b89 # Parent 1da1078a87b142729944bd7e66a99599b46f57ca allow webmcp path to be set in cgi script this allows another script to include the webmcp script when the cwd is not the cgi-bin. the script needs to set the WEBMCP_PATH variable. diff -r 1da1078a87b1 -r ea2e8f3a2776 framework/cgi-bin/webmcp.lua --- a/framework/cgi-bin/webmcp.lua Wed Sep 15 02:43:06 2010 +0200 +++ b/framework/cgi-bin/webmcp.lua Sun Sep 19 01:36:08 2010 +0200 @@ -3,8 +3,12 @@ _WEBMCP_VERSION = "1.1.1" -- include "../lib/" in search path for libraries +if not WEBMCP_PATH then + WEBMCP_PATH = "../" +end + do - package.path = '../lib/?.lua;' .. package.path + package.path = WEBMCP_PATH..'lib/?.lua;' .. package.path -- find out which file name extension shared libraries have local slib_exts = {} for ext in string.gmatch(package.cpath, "%?%.([A-Za-z0-9_-]+)") do @@ -12,10 +16,10 @@ end local paths = {} for ext in pairs(slib_exts) do - paths[#paths+1] = "../accelerator/?." .. ext + paths[#paths+1] = WEBMCP_PATH.."accelerator/?." .. ext end for ext in pairs(slib_exts) do - paths[#paths+1] = "../lib/?." .. ext + paths[#paths+1] = WEBMCP_PATH.."lib/?." .. ext end paths[#paths+1] = package.cpath package.cpath = table.concat(paths, ";") @@ -159,7 +163,7 @@ not string.find(key, "^__") then category = "env" - base_path = "../env/" + base_path = WEBMCP_PATH.."/env/" merge = true merge_base_path = app_base .. "/env/" file_key = key @@ -215,7 +219,7 @@ return rawget(self, key) end install_autoloader(_G, nil, {}) - try_exec("../env/__init.lua") + try_exec(WEBMCP_PATH.."env/__init.lua") end -- interactive console mode