mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-24 12:23:08 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
657faad984 | ||
|
|
16961a6c2c | ||
|
|
57d9592448 | ||
|
|
b941f90d24 | ||
|
|
b8acd4ca54 | ||
|
|
21412ad14c | ||
|
|
5c7eb0e1ff |
4
Makefile
4
Makefile
@@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile,v 1.34 2008/05/07 19:06:37 carregal Exp $
|
# $Id: Makefile,v 1.35 2008/12/12 13:26:37 carregal Exp $
|
||||||
|
|
||||||
T= lfs
|
T= lfs
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ OBJS= src/$T.o
|
|||||||
lib: src/lfs.so
|
lib: src/lfs.so
|
||||||
|
|
||||||
src/lfs.so: $(OBJS)
|
src/lfs.so: $(OBJS)
|
||||||
export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/lfs.so $(OBJS)
|
MACOS_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/lfs.so $(OBJS)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(LUA_LIBDIR)
|
mkdir -p $(LUA_LIBDIR)
|
||||||
|
|||||||
48
README
48
README
@@ -10,12 +10,6 @@ related to file systems offered by the standard Lua distribution.
|
|||||||
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
|
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
|
||||||
LuaFileSystem is free software and uses the same license as Lua 5.1
|
LuaFileSystem is free software and uses the same license as Lua 5.1
|
||||||
|
|
||||||
Version 1.4.1 [07/May/2008] changes:
|
|
||||||
* documentation review
|
|
||||||
* fixed Windows compilation issues
|
|
||||||
* fixed bug in the Windows tests (patch by Shmuel Zeigerman)
|
|
||||||
* fixed bug [#2185] lfs.attributes(filename, 'size') overflow on files > 2 Gb
|
|
||||||
|
|
||||||
LuaRocks Installation
|
LuaRocks Installation
|
||||||
---------------------
|
---------------------
|
||||||
luarocks install luafilesystem
|
luarocks install luafilesystem
|
||||||
@@ -36,3 +30,45 @@ To install on Windows, please copy lfs.dll to your package.cpath directory
|
|||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
Please check the documentation at /doc/us/ for more information.
|
Please check the documentation at /doc/us/ for more information.
|
||||||
|
|
||||||
|
History
|
||||||
|
-------
|
||||||
|
|
||||||
|
Version 1.4.2 [03/Feb/2009]
|
||||||
|
|
||||||
|
* fixed bug [#13198] lfs.attributes(filename, 'size') overflow on files > 2 Gb again (bug report and patch by KUBO Takehiro).
|
||||||
|
* fixed bug [#39794] Compile error on Solaris 10 (bug report and patch by Aaron B).
|
||||||
|
* fixed compilation problems with Borland C.
|
||||||
|
|
||||||
|
Version 1.4.1 [07/May/2008]
|
||||||
|
|
||||||
|
* documentation review
|
||||||
|
* fixed Windows compilation issues
|
||||||
|
* fixed bug in the Windows tests (patch by Shmuel Zeigerman)
|
||||||
|
* fixed bug [#2185] lfs.attributes(filename, 'size') overflow on files > 2 Gb
|
||||||
|
|
||||||
|
Version 1.4.0 [13/Feb/2008]
|
||||||
|
|
||||||
|
* added function lfs.setmode (works only in Windows systems).
|
||||||
|
* lfs.attributes raises an error if attribute does not exist
|
||||||
|
|
||||||
|
Version 1.3.0 [26/Oct/2007]
|
||||||
|
|
||||||
|
* added function lfs.symlinkattributes (works only in non Windows systems).
|
||||||
|
|
||||||
|
Version 1.2.1 [08/May/2007]
|
||||||
|
|
||||||
|
* compatible only with Lua 5.1 (Lua 5.0 support was dropped)
|
||||||
|
|
||||||
|
Version 1.2 [15/Mar/2006]
|
||||||
|
|
||||||
|
* added optional argument to lfs.attributes
|
||||||
|
* added function lfs.rmdir
|
||||||
|
* bug correction on lfs.dir
|
||||||
|
|
||||||
|
Version 1.1 [30/May/2005]
|
||||||
|
|
||||||
|
* added function lfs.touch.
|
||||||
|
|
||||||
|
Version 1.0 [21/Jan/2005]
|
||||||
|
Version 1.0 Beta [10/Nov/2004]
|
||||||
|
|||||||
@@ -71,19 +71,30 @@ 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.4.1. It was developed for Lua 5.1.</p>
|
<p>Current version is 1.4.2. It was developed for Lua 5.1.</p>
|
||||||
|
|
||||||
<h2><a name="download"></a>Download</h2>
|
<h2><a name="download"></a>Download</h2>
|
||||||
|
|
||||||
<p>LuaFileSystem source can be downloaded from its
|
<p>LuaFileSystem source can be downloaded from its
|
||||||
<a href="http://luaforge.net/projects/luafilesystem/files">Lua Forge</a>
|
<a href="http://luaforge.net/projects/luafilesystem/files">Lua Forge</a>
|
||||||
page. If you are using
|
page. If you are using
|
||||||
<a href="http://luabinaries.luaforge.net">LuaBinaries</a> 5.1.3 a Windows binary
|
<a href="http://luabinaries.luaforge.net">LuaBinaries</a> a Windows binary
|
||||||
version of LuaFileSystem (compiled with Visual Studio 2005 Express) can be found at the same LuaForge page.</p>
|
version of LuaFileSystem (compiled with Visual Studio 2005 Express) can be found at the same LuaForge 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.4.2</strong> [03/Feb/2009]</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li>fixed bug [<a href="http://luaforge.net/tracker/?func=detail&group_id=66&aid=13198&atid=356">#13198</a>]
|
||||||
|
lfs.attributes(filename, 'size') overflow on files > 2 Gb again (bug report and patch by KUBO Takehiro).</li>
|
||||||
|
<li>fixed bug [<a href="http://luaforge.net/tracker/?group_id=66&atid=356&func=detail&aid=39794">#39794</a>]
|
||||||
|
Compile error on Solaris 10 (bug report and patch by Aaron B).</li>
|
||||||
|
<li>fixed compilation problems with Borland C.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt><strong>Version 1.4.1</strong> [07/May/2008]</dt>
|
<dt><strong>Version 1.4.1</strong> [07/May/2008]</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -170,7 +181,7 @@ Comments are welcome!</p>
|
|||||||
|
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||||
<p><small>$Id: index.html,v 1.42 2008/05/07 19:06:37 carregal Exp $</small></p>
|
<p><small>$Id: index.html,v 1.43 2009/02/03 22:05:49 carregal Exp $</small></p>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
|
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ The file has some definitions like paths to the external libraries,
|
|||||||
compiler options and the like.
|
compiler options and the like.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>On Windows, the C runtime used to compile LuaFileSystem must be the same
|
||||||
|
runtime that Lua uses, or some LuaFileSystem functions will not work.</p>
|
||||||
|
|
||||||
<h2><a name="installation"></a>Installation</h2>
|
<h2><a name="installation"></a>Installation</h2>
|
||||||
|
|
||||||
<p>The easiest way to install LuaFileSystem is to use LuaRocks:</p>
|
<p>The easiest way to install LuaFileSystem is to use LuaRocks:</p>
|
||||||
@@ -248,7 +251,7 @@ LuaFileSystem offers the following functions:
|
|||||||
|
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||||
<p><small>$Id: manual.html,v 1.42 2008/03/24 18:17:59 carregal Exp $</small></p>
|
<p><small>$Id: manual.html,v 1.43 2008/05/08 18:45:15 carregal Exp $</small></p>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
|
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package = "LuaFileSystem"
|
package = "LuaFileSystem"
|
||||||
version = "1.4.1-1"
|
version = "1.4.1-1"
|
||||||
source = {
|
source = {
|
||||||
url = "",
|
url = "http://luaforge.net/frs/download.php/3345/luafilesystem-1.4.1.tar.gz",
|
||||||
}
|
}
|
||||||
description = {
|
description = {
|
||||||
summary = "File System Library for the Lua Programming Language",
|
summary = "File System Library for the Lua Programming Language",
|
||||||
|
|||||||
26
rockspecs/luafilesystem-1.4.2-1.rockspec
Normal file
26
rockspecs/luafilesystem-1.4.2-1.rockspec
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package = "LuaFileSystem"
|
||||||
|
|
||||||
|
version = "1.4.2-1"
|
||||||
|
|
||||||
|
source = {
|
||||||
|
url = "http://luaforge.net/frs/download.php/3345/luafilesystem-1.4.1.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 = "module",
|
||||||
|
modules = { lfs = "src/lfs.c" }
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package = "LuaFileSystem"
|
package = "LuaFileSystem"
|
||||||
|
|
||||||
version = "cvs-2"
|
version = "cvs-2"
|
||||||
|
|
||||||
source = {
|
source = {
|
||||||
url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem",
|
url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem",
|
||||||
cvs_tag = "HEAD"
|
cvs_tag = "HEAD"
|
||||||
}
|
}
|
||||||
|
|
||||||
description = {
|
description = {
|
||||||
summary = "File System Library for the Lua Programming Language",
|
summary = "File System Library for the Lua Programming Language",
|
||||||
detailed = [[
|
detailed = [[
|
||||||
@@ -13,32 +16,12 @@ description = {
|
|||||||
underlying directory structure and file attributes.
|
underlying directory structure and file attributes.
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"lua >= 5.1"
|
"lua >= 5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
build = {
|
build = {
|
||||||
platforms = {
|
type = "module",
|
||||||
unix = {
|
modules = { lfs = "src/lfs.c" }
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LIB_OPTION = "$(LIBFLAG)",
|
|
||||||
CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR) $(STAT64)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
win32 = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib",
|
|
||||||
CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)",
|
|
||||||
LUA_DIR = "$(LUADIR)",
|
|
||||||
BIN_DIR = "$(BINDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
31
src/lfs.c
31
src/lfs.c
@@ -16,9 +16,17 @@
|
|||||||
** lfs.touch (filepath [, atime [, mtime]])
|
** lfs.touch (filepath [, atime [, mtime]])
|
||||||
** lfs.unlock (fh)
|
** lfs.unlock (fh)
|
||||||
**
|
**
|
||||||
** $Id: lfs.c,v 1.53 2008/05/07 19:06:37 carregal Exp $
|
** $Id: lfs.c,v 1.56 2009/02/03 22:05:48 carregal Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#ifndef _AIX
|
||||||
|
#define _FILE_OFFSET_BITS 64 /* Linux, Solaris and HP-UX */
|
||||||
|
#else
|
||||||
|
#define _LARGE_FILES 1 /* AIX */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _LARGEFILE64_SOURCE
|
#define _LARGEFILE64_SOURCE
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -32,7 +40,11 @@
|
|||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <sys/locking.h>
|
#include <sys/locking.h>
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#include <utime.h>
|
||||||
|
#else
|
||||||
#include <sys/utime.h>
|
#include <sys/utime.h>
|
||||||
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -74,24 +86,23 @@ typedef struct dir_data {
|
|||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#define lfs_setmode(L,file,m) ((void)L, setmode(_fileno(file), m))
|
||||||
|
#define STAT_STRUCT struct stati64
|
||||||
|
#else
|
||||||
#define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m))
|
#define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m))
|
||||||
#define STAT_STRUCT struct _stati64
|
#define STAT_STRUCT struct _stati64
|
||||||
|
#endif
|
||||||
#define STAT_FUNC _stati64
|
#define STAT_FUNC _stati64
|
||||||
#else
|
#else
|
||||||
#define _O_TEXT 0
|
#define _O_TEXT 0
|
||||||
#define _O_BINARY 0
|
#define _O_BINARY 0
|
||||||
#define lfs_setmode(L,file,m) ((void)((void)file,m), \
|
#define lfs_setmode(L,file,m) ((void)((void)file,m), \
|
||||||
luaL_error(L, LUA_QL("setmode") " not supported on this platform"), -1)
|
luaL_error(L, LUA_QL("setmode") " not supported on this platform"), -1)
|
||||||
#ifdef HAVE_STAT64
|
|
||||||
#define STAT_STRUCT struct stat64
|
|
||||||
#define STAT_FUNC stat64
|
|
||||||
#define LSTAT_FUNC lstat64
|
|
||||||
#else
|
|
||||||
#define STAT_STRUCT struct stat
|
#define STAT_STRUCT struct stat
|
||||||
#define STAT_FUNC stat
|
#define STAT_FUNC stat
|
||||||
#define LSTAT_FUNC lstat
|
#define LSTAT_FUNC lstat
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This function changes the working (current) directory
|
** This function changes the working (current) directory
|
||||||
@@ -173,7 +184,11 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star
|
|||||||
len = ftell (fh);
|
len = ftell (fh);
|
||||||
}
|
}
|
||||||
fseek (fh, start, SEEK_SET);
|
fseek (fh, start, SEEK_SET);
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
code = locking (fileno(fh), lkmode, len);
|
||||||
|
#else
|
||||||
code = _locking (fileno(fh), lkmode, len);
|
code = _locking (fileno(fh), lkmode, len);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
struct flock f;
|
struct flock f;
|
||||||
switch (*mode) {
|
switch (*mode) {
|
||||||
@@ -656,7 +671,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.4.1");
|
lua_pushliteral (L, "LuaFileSystem 1.4.2");
|
||||||
lua_settable (L, -3);
|
lua_settable (L, -3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
LIBRARY lfs.dll
|
LIBRARY lfs.dll
|
||||||
DESCRIPTION "LuaFileSystem"
|
DESCRIPTION "LuaFileSystem"
|
||||||
VERSION 1.4.1
|
VERSION 1.4.2
|
||||||
EXPORTS
|
EXPORTS
|
||||||
luaopen_lfs
|
luaopen_lfs
|
||||||
|
|||||||
Reference in New Issue
Block a user