summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-12-23 09:06:05 +0000
committerTed Trask <ttrask01@yahoo.com>2009-12-23 09:06:05 +0000
commitda8d6a71739aa6e1eff39a099893b33b1ad51569 (patch)
tree7f3d3c92921b078bbf471c33a98f5a64418d0c72
parentcc1fca725c652ac4823da6a294188503079196c9 (diff)
downloadacf-core-da8d6a71739aa6e1eff39a099893b33b1ad51569.tar.bz2
acf-core-da8d6a71739aa6e1eff39a099893b33b1ad51569.tar.xz
Fixed bug in loading controllers - allow '.' in path
-rwxr-xr-xwww/cgi-bin/mvc.lua15
1 files changed, 5 insertions, 10 deletions
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua
index a36878c..d7824d1 100755
--- a/www/cgi-bin/mvc.lua
+++ b/www/cgi-bin/mvc.lua
@@ -36,7 +36,7 @@ new = function (self, modname)
-- If no clientdata, then clientdata is a null table
if self.clientdata == nil then
c.clientdata = {}
- end
+ end
-- If we don't have an application name, use the modname
if (self.conf == nil ) or (self.conf.appname == nil) then
@@ -215,8 +215,8 @@ 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 = self.conf.appdir .. "?" .. ".lua;" .. package.path
- local t = require(name)
+ package.path = self.conf.appdir .. dirname(name) .. "/?.lua;" .. package.path
+ local t = require(basename(name))
package.path = PATH
return t
end
@@ -234,13 +234,8 @@ basename = function (string, suffix)
end
-- see man dirname.1
-dirname = function ( string)
- string = string or ""
- -- strip trailing / first
- string = string.gsub (string, "/$", "")
- local basename = basename ( string)
- string = string.sub(string, 1, #string - #basename - 1)
- return(string)
+dirname = function (string)
+ return (string.gsub (string or "", "/?[^/]*$", ""))
end
-- look in various places for a config file, and store it in self.conf