From 4f3ecab1e7390850b81f5366afb5a189c81fb1b3 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 17 Nov 2010 09:18:01 +0000 Subject: Changed mvc soft_require to include the prefix to avoid controller name conflict problems. --- www/cgi-bin/mvc.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'www') diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index 78cdc0e..41aa9db 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -222,8 +222,13 @@ soft_require = function (self, name ) -- and if it doesnt exist silently fail. -- This version allows things from /usr/local/lua/5.1 to -- be loaded - package.path = p .. posix.dirname(name) .. "/?.lua;" .. package.path - local t = require(posix.basename(name)) + package.path = p .. "/?.lua;" .. package.path + local t + if posix.dirname(name) == "." then + t = require(posix.basename(name)) + else + t = require(posix.basename(posix.dirname(name)).."."..posix.basename(name)) + end package.path = PATH return t end -- cgit v1.2.3