'searchpath' changes dots into directory separators
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: loadlib.c,v 1.76 2010/01/11 17:11:24 roberto Exp roberto $
|
** $Id: loadlib.c,v 1.77 2010/01/11 17:34:59 roberto Exp roberto $
|
||||||
** Dynamic library loader for Lua
|
** Dynamic library loader for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
**
|
**
|
||||||
@@ -397,6 +397,7 @@ static const char *pushnexttemplate (lua_State *L, const char *path) {
|
|||||||
|
|
||||||
static const char *searchpath (lua_State *L, const char *name,
|
static const char *searchpath (lua_State *L, const char *name,
|
||||||
const char *path) {
|
const char *path) {
|
||||||
|
name = luaL_gsub(L, name, ".", LUA_DIRSEP);
|
||||||
lua_pushliteral(L, ""); /* error accumulator */
|
lua_pushliteral(L, ""); /* error accumulator */
|
||||||
while ((path = pushnexttemplate(L, path)) != NULL) {
|
while ((path = pushnexttemplate(L, path)) != NULL) {
|
||||||
const char *filename = luaL_gsub(L, lua_tostring(L, -1),
|
const char *filename = luaL_gsub(L, lua_tostring(L, -1),
|
||||||
@@ -426,7 +427,6 @@ static int ll_searchpath (lua_State *L) {
|
|||||||
static const char *findfile (lua_State *L, const char *name,
|
static const char *findfile (lua_State *L, const char *name,
|
||||||
const char *pname) {
|
const char *pname) {
|
||||||
const char *path;
|
const char *path;
|
||||||
name = luaL_gsub(L, name, ".", LUA_DIRSEP);
|
|
||||||
lua_getfield(L, LUA_ENVIRONINDEX, pname);
|
lua_getfield(L, LUA_ENVIRONINDEX, pname);
|
||||||
path = lua_tostring(L, -1);
|
path = lua_tostring(L, -1);
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user