mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-23 19:43:06 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7eea62957 | ||
|
|
1b5073419f | ||
|
|
fe964e013d | ||
|
|
12d1692f14 | ||
|
|
de87218e97 | ||
|
|
a23cadf009 |
4
Makefile
4
Makefile
@@ -18,8 +18,8 @@ test: lib
|
|||||||
LUA_CPATH=./src/?.so lua tests/test.lua
|
LUA_CPATH=./src/?.so lua tests/test.lua
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(LUA_LIBDIR)
|
mkdir -p $(DESTDIR)$(LUA_LIBDIR)
|
||||||
cp src/lfs.so $(LUA_LIBDIR)
|
cp src/lfs.so $(DESTDIR)$(LUA_LIBDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f src/lfs.so $(OBJS)
|
rm -f src/lfs.so $(OBJS)
|
||||||
|
|||||||
28
rockspecs/luafilesystem-1.7.0-2.rockspec
Normal file
28
rockspecs/luafilesystem-1.7.0-2.rockspec
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package = "LuaFileSystem"
|
||||||
|
version = "1.7.0-2"
|
||||||
|
source = {
|
||||||
|
url = "git://github.com/keplerproject/luafilesystem",
|
||||||
|
tag = "v1_7_0_2",
|
||||||
|
}
|
||||||
|
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.
|
||||||
|
]],
|
||||||
|
license = "MIT/X11",
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua >= 5.1"
|
||||||
|
}
|
||||||
|
build = {
|
||||||
|
type = "builtin",
|
||||||
|
modules = {
|
||||||
|
lfs = "src/lfs.c"
|
||||||
|
},
|
||||||
|
copy_directories = {
|
||||||
|
"doc", "tests"
|
||||||
|
}
|
||||||
|
}
|
||||||
18
src/lfs.c
18
src/lfs.c
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
#include "lfs.h"
|
#include "lfs.h"
|
||||||
|
|
||||||
#define LFS_VERSION "1.6.3"
|
#define LFS_VERSION "1.7.0"
|
||||||
#define LFS_LIBNAME "lfs"
|
#define LFS_LIBNAME "lfs"
|
||||||
|
|
||||||
#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */
|
#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */
|
||||||
@@ -186,9 +186,12 @@ static int get_dir (lua_State *L) {
|
|||||||
size_t size = LFS_MAXPATHLEN; /* initial buffer size */
|
size_t size = LFS_MAXPATHLEN; /* initial buffer size */
|
||||||
int result;
|
int result;
|
||||||
while (1) {
|
while (1) {
|
||||||
path = realloc(path, size);
|
char* path2 = realloc(path, size);
|
||||||
if (!path) /* failed to allocate */
|
if (!path2) /* failed to allocate */ {
|
||||||
return pusherror(L, "get_dir realloc() failed");
|
result = pusherror(L, "get_dir realloc() failed");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
path = path2;
|
||||||
if (getcwd(path, size) != NULL) {
|
if (getcwd(path, size) != NULL) {
|
||||||
/* success, push the path to the Lua stack */
|
/* success, push the path to the Lua stack */
|
||||||
lua_pushstring(L, path);
|
lua_pushstring(L, path);
|
||||||
@@ -860,9 +863,12 @@ static int push_link_target(lua_State *L) {
|
|||||||
char *target = NULL;
|
char *target = NULL;
|
||||||
int tsize, size = 256; /* size = initial buffer capacity */
|
int tsize, size = 256; /* size = initial buffer capacity */
|
||||||
while (1) {
|
while (1) {
|
||||||
target = realloc(target, size);
|
char* target2 = realloc(target, size);
|
||||||
if (!target) /* failed to allocate */
|
if (!target2) { /* failed to allocate */
|
||||||
|
free(target);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
target = target2;
|
||||||
tsize = readlink(file, target, size);
|
tsize = readlink(file, target, size);
|
||||||
if (tsize < 0) { /* a readlink() error occurred */
|
if (tsize < 0) { /* a readlink() error occurred */
|
||||||
free(target);
|
free(target);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
LIBRARY lfs.dll
|
LIBRARY lfs.dll
|
||||||
VERSION 1.6
|
VERSION 1.7
|
||||||
EXPORTS
|
EXPORTS
|
||||||
luaopen_lfs
|
luaopen_lfs
|
||||||
|
|||||||
Reference in New Issue
Block a user