aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rockspecs/luafilesystem-1.3.0-1.rockspec27
-rw-r--r--rockspecs/luafilesystem-cvs-1.rockspec23
-rw-r--r--src/lfs.c23
3 files changed, 62 insertions, 11 deletions
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 @@
1package = "LuaFileSystem"
2version = "1.3.0-1"
3source = {
4 url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.tar.gz"
5}
6description = {
7 summary = "File System Library for the Lua Programming Language",
8 detailed = [[
9 LuaFileSystem is a Lua library developed to complement the set of
10 functions related to file systems offered by the standard Lua
11 distribution. LuaFileSystem offers a portable way to access the
12 underlying directory structure and file attributes.
13 ]]
14}
15dependencies = {
16 "lua >= 5.1"
17}
18build = {
19 type = "make",
20 build_variables = {
21 LUA_INC = "$(LUA_INCDIR)",
22 LIB_OPTION = "$(LIBFLAG)"
23 },
24 install_variables = {
25 LUA_LIBDIR = "$(LIBDIR)"
26 }
27}
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 @@
1package = "LuaFileSystem"
2version = "cvs-1"
3source = {
4 url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem"
5}
6description = {
7 summary = "File System Library for the Lua Programming Language",
8 detailed = [[
9 LuaFileSystem is a Lua library developed to complement the set of
10 functions related to file systems offered by the standard Lua
11 distribution. LuaFileSystem offers a portable way to access the
12 underlying directory structure and file attributes.
13 ]]
14}
15dependencies = {
16 "lua >= 5.1"
17}
18build = {
19 type = "module",
20 modules = {
21 lfs = "lfs.c"
22 }
23}
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 @@
15** lfs.touch (filepath [, atime [, mtime]]) 15** lfs.touch (filepath [, atime [, mtime]])
16** lfs.unlock (fh) 16** lfs.unlock (fh)
17** 17**
18** $Id: lfs.c,v 1.43 2007/12/22 17:19:45 mascarenhas Exp $ 18** $Id: lfs.c,v 1.44 2008/01/16 22:29:26 mascarenhas Exp $
19*/ 19*/
20 20
21#include <errno.h> 21#include <errno.h>
@@ -100,16 +100,17 @@ static int change_dir (lua_State *L) {
100** and a string describing the error 100** and a string describing the error
101*/ 101*/
102static int get_dir (lua_State *L) { 102static int get_dir (lua_State *L) {
103 char path[255+2]; 103 char *path;
104 if (getcwd(path, 255) == NULL) { 104 if ((path = getcwd(NULL, 0)) == NULL) {
105 lua_pushnil(L); 105 lua_pushnil(L)
106 lua_pushstring(L, getcwd_error); 106 lua_pushstring(L, getcwd_error);
107 return 2; 107 return 2;
108 } 108 }
109 else { 109 else {
110 lua_pushstring(L, path); 110 lua_pushstring(L, path);
111 return 1; 111 free(path);
112 } 112 return 1;
113 }
113} 114}
114 115
115/* 116/*