diff --git a/rockspecs/luafilesystem-1.3.0-1.rockspec b/rockspecs/luafilesystem-1.3.0-1.rockspec new file mode 100644 index 0000000..d4d484f --- /dev/null +++ b/rockspecs/luafilesystem-1.3.0-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" +version = "1.3.0-1" +source = { + url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.tar.gz" +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "make", + build_variables = { + LUA_INC = "$(LUA_INCDIR)", + LIB_OPTION = "$(LIBFLAG)" + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } +} diff --git a/rockspecs/luafilesystem-cvs-1.rockspec b/rockspecs/luafilesystem-cvs-1.rockspec new file mode 100644 index 0000000..686c6f9 --- /dev/null +++ b/rockspecs/luafilesystem-cvs-1.rockspec @@ -0,0 +1,23 @@ +package = "LuaFileSystem" +version = "cvs-1" +source = { + url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem" +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "module", + modules = { + lfs = "lfs.c" + } +} diff --git a/src/lfs.c b/src/lfs.c index 8142c91..1fa0a5e 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -15,7 +15,7 @@ ** lfs.touch (filepath [, atime [, mtime]]) ** lfs.unlock (fh) ** -** $Id: lfs.c,v 1.43 2007/12/22 17:19:45 mascarenhas Exp $ +** $Id: lfs.c,v 1.44 2008/01/16 22:29:26 mascarenhas Exp $ */ #include @@ -100,16 +100,17 @@ static int change_dir (lua_State *L) { ** and a string describing the error */ static int get_dir (lua_State *L) { - char path[255+2]; - if (getcwd(path, 255) == NULL) { - lua_pushnil(L); - lua_pushstring(L, getcwd_error); - return 2; - } - else { - lua_pushstring(L, path); - return 1; - } + char *path; + if ((path = getcwd(NULL, 0)) == NULL) { + lua_pushnil(L) + lua_pushstring(L, getcwd_error); + return 2; + } + else { + lua_pushstring(L, path); + free(path); + return 1; + } } /*