mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-24 20:33:06 +00:00
Merge pull request #18 from devurandom/fix/lua52
Full Lua 5.2 compatibility and adherance to modules-create-no-globals
This commit is contained in:
3
README
3
README
@@ -22,6 +22,9 @@ Please check the documentation at doc/us/ for more information.
|
|||||||
History
|
History
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
Version 1.6.2 [??/Oct/2012]
|
||||||
|
* Full Lua 5.2 compatibility (with Lua 5.1 fallbacks)
|
||||||
|
|
||||||
Version 1.6.1 [01/Oct/2012]
|
Version 1.6.1 [01/Oct/2012]
|
||||||
* fix build for Lua 5.2
|
* fix build for Lua 5.2
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
attributes for each file inside it.</p>
|
attributes for each file inside it.</p>
|
||||||
|
|
||||||
<pre class="example">
|
<pre class="example">
|
||||||
require"lfs"
|
local lfs = require"lfs"
|
||||||
|
|
||||||
function attrdir (path)
|
function attrdir (path)
|
||||||
for file in lfs.dir(path) do
|
for file in lfs.dir(path) do
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ the underlying directory structure and file attributes.</p>
|
|||||||
|
|
||||||
<h2><a name="status"></a>Status</h2>
|
<h2><a name="status"></a>Status</h2>
|
||||||
|
|
||||||
<p>Current version is 1.6.0. It was developed for Lua 5.1 but also
|
<p>Current version is 1.6.2. It was developed for Lua 5.1 but also
|
||||||
works with Lua 5.2.</p>
|
works with Lua 5.2.</p>
|
||||||
|
|
||||||
<h2><a name="download"></a>Download</h2>
|
<h2><a name="download"></a>Download</h2>
|
||||||
@@ -83,6 +83,11 @@ page.</p>
|
|||||||
<h2><a name="history"></a>History</h2>
|
<h2><a name="history"></a>History</h2>
|
||||||
|
|
||||||
<dl class="history">
|
<dl class="history">
|
||||||
|
<dt><strong>Version 1.6.2</strong> [??/Oct/2012]</dt>
|
||||||
|
<dd><ul>
|
||||||
|
<li>Full Lua 5.2 compatibility (with Lua 5.1 fallbacks)</li>
|
||||||
|
</ul></dd>
|
||||||
|
|
||||||
<dt><strong>Version 1.6.1</strong> [01/Oct/2012]</dt>
|
<dt><strong>Version 1.6.1</strong> [01/Oct/2012]</dt>
|
||||||
<dd><ul>
|
<dd><ul>
|
||||||
<li>fix build for Lua 5.2</li>
|
<li>fix build for Lua 5.2</li>
|
||||||
|
|||||||
27
rockspecs/luafilesystem-1.6.2-1.rockspec
Normal file
27
rockspecs/luafilesystem-1.6.2-1.rockspec
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package = "LuaFileSystem"
|
||||||
|
|
||||||
|
version = "1.6.2-1"
|
||||||
|
|
||||||
|
source = {
|
||||||
|
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.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 = "builtin",
|
||||||
|
modules = { lfs = "src/lfs.c" },
|
||||||
|
copy_directories = { "doc", "tests" }
|
||||||
|
}
|
||||||
25
src/lfs.c
25
src/lfs.c
@@ -56,20 +56,17 @@
|
|||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LUA_COMPAT_ALL
|
#include <lua.h>
|
||||||
#include "lua.h"
|
#include <lauxlib.h>
|
||||||
#include "lauxlib.h"
|
#include <lualib.h>
|
||||||
#include "lualib.h"
|
|
||||||
#include "lfs.h"
|
#include "lfs.h"
|
||||||
|
|
||||||
/*
|
#define LFS_VERSION "1.6.2"
|
||||||
* ** compatibility with Lua 5.2
|
#define LFS_LIBNAME "lfs"
|
||||||
* */
|
|
||||||
#if (LUA_VERSION_NUM == 502)
|
|
||||||
#undef luaL_register
|
|
||||||
#define luaL_register(L,n,f) \
|
|
||||||
{ if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); }
|
|
||||||
|
|
||||||
|
#if LUA_VERSION_NUM < 502
|
||||||
|
# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define 'strerror' for systems that do not implement it */
|
/* Define 'strerror' for systems that do not implement it */
|
||||||
@@ -856,7 +853,7 @@ static void set_info (lua_State *L) {
|
|||||||
lua_pushliteral (L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution");
|
lua_pushliteral (L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution");
|
||||||
lua_settable (L, -3);
|
lua_settable (L, -3);
|
||||||
lua_pushliteral (L, "_VERSION");
|
lua_pushliteral (L, "_VERSION");
|
||||||
lua_pushliteral (L, "LuaFileSystem 1.6.0");
|
lua_pushliteral (L, "LuaFileSystem "LFS_VERSION);
|
||||||
lua_settable (L, -3);
|
lua_settable (L, -3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,7 +878,9 @@ static const struct luaL_Reg fslib[] = {
|
|||||||
int luaopen_lfs (lua_State *L) {
|
int luaopen_lfs (lua_State *L) {
|
||||||
dir_create_meta (L);
|
dir_create_meta (L);
|
||||||
lock_create_meta (L);
|
lock_create_meta (L);
|
||||||
luaL_register (L, "lfs", fslib);
|
luaL_newlib (L, fslib);
|
||||||
|
lua_pushvalue(L, -1);
|
||||||
|
lua_setglobal(L, LFS_LIBNAME);
|
||||||
set_info (L);
|
set_info (L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user