mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-22 02:53:06 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
657faad984 | ||
|
|
16961a6c2c | ||
|
|
57d9592448 | ||
|
|
b941f90d24 | ||
|
|
b8acd4ca54 | ||
|
|
21412ad14c | ||
|
|
5c7eb0e1ff | ||
|
|
1e40455d39 | ||
|
|
d4bfd537a8 | ||
|
|
d7a5679fb8 |
6
Makefile
6
Makefile
@@ -1,7 +1,7 @@
|
||||
# $Id: Makefile,v 1.33 2008/03/25 18:24:17 mascarenhas Exp $
|
||||
# $Id: Makefile,v 1.35 2008/12/12 13:26:37 carregal Exp $
|
||||
|
||||
T= lfs
|
||||
V= 1.4.0
|
||||
|
||||
CONFIG= ./config
|
||||
|
||||
include $(CONFIG)
|
||||
@@ -12,7 +12,7 @@ OBJS= src/$T.o
|
||||
lib: src/lfs.so
|
||||
|
||||
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:
|
||||
mkdir -p $(LUA_LIBDIR)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# $Id: Makefile.win,v 1.10 2008/02/13 22:08:31 carregal Exp $
|
||||
# $Id: Makefile.win,v 1.11 2008/05/07 19:06:37 carregal Exp $
|
||||
|
||||
T= lfs
|
||||
V= 1.4.0
|
||||
|
||||
include config.win
|
||||
|
||||
|
||||
48
README
48
README
@@ -10,8 +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 is free software and uses the same license as Lua 5.1
|
||||
|
||||
Current version is 1.4.0
|
||||
|
||||
LuaRocks Installation
|
||||
---------------------
|
||||
luarocks install luafilesystem
|
||||
@@ -27,8 +25,50 @@ The last step may require root privileges.
|
||||
|
||||
Windows Installation
|
||||
--------------------
|
||||
To install on Windows, please copy lfs.ddl to your package.cpath directory
|
||||
To install on Windows, please copy lfs.dll to your package.cpath directory
|
||||
|
||||
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,42 @@ the underlying directory structure and file attributes.</p>
|
||||
|
||||
<h2><a name="status"></a>Status</h2>
|
||||
|
||||
<p>Current version is 1.4.0. 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>
|
||||
|
||||
<p>LuaFileSystem source can be downloaded from its
|
||||
<a href="http://luaforge.net/projects/luafilesystem/files">Lua Forge</a>
|
||||
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>
|
||||
|
||||
<h2><a name="history"></a>History</h2>
|
||||
|
||||
<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>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>documentation review</li>
|
||||
<li>fixed Windows compilation issues</li>
|
||||
<li>fixed bug in the Windows tests (patch by Shmuel Zeigerman)</li>
|
||||
<li>fixed bug [<a href="http://luaforge.net/tracker/?func=detail&group_id=66&aid=2185&atid=356">#2185</a>]
|
||||
<code>lfs.attributes(filename, 'size')</code> overflow on files > 2 Gb
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.4.0</strong> [13/Feb/2008]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
@@ -158,7 +181,7 @@ Comments are welcome!</p>
|
||||
|
||||
<div id="about">
|
||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||
<p><small>$Id: index.html,v 1.41 2008/02/18 17:20:16 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="container" -->
|
||||
|
||||
@@ -80,6 +80,9 @@ The file has some definitions like paths to the external libraries,
|
||||
compiler options and the like.
|
||||
</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>
|
||||
|
||||
<p>The easiest way to install LuaFileSystem is to use LuaRocks:</p>
|
||||
@@ -248,7 +251,7 @@ LuaFileSystem offers the following functions:
|
||||
|
||||
<div id="about">
|
||||
<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="container" -->
|
||||
|
||||
43
rockspecs/luafilesystem-1.4.1-1.rockspec
Normal file
43
rockspecs/luafilesystem-1.4.1-1.rockspec
Normal file
@@ -0,0 +1,43 @@
|
||||
package = "LuaFileSystem"
|
||||
version = "1.4.1-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 = {
|
||||
platforms = {
|
||||
unix = {
|
||||
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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
|
||||
version = "cvs-2"
|
||||
|
||||
source = {
|
||||
url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem",
|
||||
cvs_tag = "HEAD"
|
||||
}
|
||||
|
||||
description = {
|
||||
summary = "File System Library for the Lua Programming Language",
|
||||
detailed = [[
|
||||
@@ -13,32 +16,12 @@ description = {
|
||||
underlying directory structure and file attributes.
|
||||
]]
|
||||
}
|
||||
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
|
||||
build = {
|
||||
platforms = {
|
||||
unix = {
|
||||
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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
type = "module",
|
||||
modules = { lfs = "src/lfs.c" }
|
||||
}
|
||||
|
||||
39
src/lfs.c
39
src/lfs.c
@@ -16,9 +16,17 @@
|
||||
** lfs.touch (filepath [, atime [, mtime]])
|
||||
** lfs.unlock (fh)
|
||||
**
|
||||
** $Id: lfs.c,v 1.51 2008/03/25 18:20:29 mascarenhas 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
|
||||
|
||||
#include <errno.h>
|
||||
@@ -32,7 +40,11 @@
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <sys/locking.h>
|
||||
#include <sys/utime.h>
|
||||
#ifdef __BORLANDC__
|
||||
#include <utime.h>
|
||||
#else
|
||||
#include <sys/utime.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -74,24 +86,23 @@ typedef struct dir_data {
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m))
|
||||
#define STAT_STRUCT struct _stat64
|
||||
#define STAT_FUNC _stat64
|
||||
#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 STAT_STRUCT struct _stati64
|
||||
#endif
|
||||
#define STAT_FUNC _stati64
|
||||
#else
|
||||
#define _O_TEXT 0
|
||||
#define _O_BINARY 0
|
||||
#define lfs_setmode(L,file,m) ((void)((void)file,m), \
|
||||
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_FUNC stat
|
||||
#define LSTAT_FUNC lstat
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** 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);
|
||||
}
|
||||
fseek (fh, start, SEEK_SET);
|
||||
#ifdef __BORLANDC__
|
||||
code = locking (fileno(fh), lkmode, len);
|
||||
#else
|
||||
code = _locking (fileno(fh), lkmode, len);
|
||||
#endif
|
||||
#else
|
||||
struct flock f;
|
||||
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_settable (L, -3);
|
||||
lua_pushliteral (L, "_VERSION");
|
||||
lua_pushliteral (L, "LuaFileSystem 1.4.0");
|
||||
lua_pushliteral (L, "LuaFileSystem 1.4.2");
|
||||
lua_settable (L, -3);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
LIBRARY lfs.dll
|
||||
DESCRIPTION "LuaFileSystem"
|
||||
VERSION 1.4.0
|
||||
VERSION 1.4.2
|
||||
EXPORTS
|
||||
luaopen_lfs
|
||||
|
||||
Reference in New Issue
Block a user