4 Commits
2.0 ... v1_2_1

Author SHA1 Message Date
carregal
2afb826d96 Merging README 2007-05-08 22:11:42 +00:00
carregal
00be93ab51 Merging the trunk changes for the 1.2.1 release 2007-05-08 21:35:10 +00:00
carregal
0147f85957 Merging the documentation from HEAD 2006-03-15 20:30:53 +00:00
carregal
d5c95fbf86 Merging of VC6 files from HEAD 2006-03-15 19:36:19 +00:00
12 changed files with 114 additions and 46 deletions

View File

@@ -1,28 +1,23 @@
# $Id: Makefile,v 1.26 2005/06/27 17:06:01 tomas Exp $
# $Id: Makefile,v 1.26.2.1 2007/05/08 21:35:11 carregal Exp $
T= lfs
V= 1.2
V= 1.2.1
CONFIG= ./config
include $(CONFIG)
COMPAT_O= $(COMPAT_DIR)/compat-5.1.o
SRCS= src/$T.c
OBJS= src/$T.o $(COMPAT_O)
OBJS= src/$T.o
lib: src/$(LIBNAME)
src/$(LIBNAME): $(OBJS)
export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/$(LIBNAME) $(OBJS)
$(COMPAT_O): $(COMPAT_DIR)/compat-5.1.c
$(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c
install: src/$(LIBNAME)
mkdir -p $(LUA_LIBDIR)
cp src/$(LIBNAME) $(LUA_LIBDIR)
cd $(LUA_LIBDIR); ln -f -s $(LIBNAME) $T.so
clean:
rm -f src/$(LIBNAME) $(OBJS) $(COMPAT_O)
rm -f src/$(LIBNAME) $(OBJS)

24
Makefile.win Normal file
View File

@@ -0,0 +1,24 @@
# $Id: Makefile.win,v 1.4.2.1 2007/05/08 21:35:11 carregal Exp $
T= lfs
V= 1.2.1
include config.win
SRCS= src\$T.c
OBJS= src\$T.obj
lib: src\$(LIBNAME)
.c.obj:
$(CC) /c /Fo$@ $(CFLAGS) $<
src\$(LIBNAME): $(OBJS)
link /dll /def:src\$T.def /out:src\$(LIBNAME) $(OBJS) $(LUA_LIB)
install: src\$(LIBNAME)
IF NOT EXIST $(LUA_LIBDIR) mkdir $(LUA_LIBDIR)
copy src\$(LIBNAME) $(LUA_LIBDIR)
clean:
del src\$(LIBNAME) $(OBJS) src\$T.lib src\$T.exp

14
README Normal file
View File

@@ -0,0 +1,14 @@
LuaFileSystem - File System Library for Lua
Copyright 2003-2007 PUC-Rio
http://www.keplerproject.org/luafilesystem
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. LuaFileSystem is free software and uses the same license as Lua 5.1 Current version is 1.2.1.
To install on Linux/OSX/BSD, please edit the config file and then call
make
make install
The last step may require root privileges.
Please check the documentation at /doc/us/ for more information.

9
config
View File

@@ -1,20 +1,19 @@
# Installation directories
# System's libraries directory (where binary libraries are installed)
LUA_LIBDIR= /usr/local/lib/lua/5.0
LUA_LIBDIR= /usr/local/lib/lua/5.1
# Lua includes directory
LUA_INC= /usr/local/include
LUA_INC= /usr/local/include/lua51
# OS dependent
LIB_OPTION= -shared #for Linux
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
LIBNAME= $T.so.$V
COMPAT_DIR= ../compat/src
# Compilation directives
WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings
INCS= -I$(LUA_INC) -I$(COMPAT_DIR)
INCS= -I$(LUA_INC)
CFLAGS= $(WARN) $(INCS)
CC= gcc
# $Id: config,v 1.14 2005/06/24 01:49:16 tomas Exp $
# $Id: config,v 1.14.2.1 2007/05/08 21:35:10 carregal Exp $

17
config.win Normal file
View File

@@ -0,0 +1,17 @@
# Installation directories
# System's libraries directory (where binary libraries are installed)
LUA_LIBDIR= c:\lua5.1\lib
# Lua includes directory
LUA_INC= c:\lua5.1\include
# Lua library
LUA_LIB= c:\lua5.1\bin\lua5.1.lib
LIBNAME= $T.dll
# Compilation directives
WARN= /O2
INCS= /I$(LUA_INC)
CFLAGS= $(WARN) $(INCS)
CC= cl
# $Id: config.win,v 1.3.2.1 2007/05/08 21:35:10 carregal Exp $

View File

@@ -39,6 +39,7 @@
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#building">Building</a></li>
<li><a href="manual.html#installation">Installation</a></li>
<li><a href="manual.html#reference">Reference</a></li>
</ul>
@@ -94,7 +95,7 @@ attrdir (".")
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>$Id: examples.html,v 1.5 2006/03/14 14:07:55 carregal Exp $</small></p>
<p><small>$Id: examples.html,v 1.5.2.1 2007/05/08 21:35:11 carregal Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

View File

@@ -39,6 +39,7 @@
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#building">Building</a></li>
<li><a href="manual.html#installation">Installation</a></li>
<li><a href="manual.html#reference">Reference</a></li>
</ul>
@@ -66,31 +67,30 @@ systems offered by the standard Lua distribution.</p>
the underlying directory structure and file attributes.</p>
<p>LuaFileSystem is free software and uses the same
<a href="license.html">license</a> as Lua 5.0.</p>
<a href="license.html">license</a> as Lua 5.1.</p>
<h2><a name="status"></a>Status</h2>
<p>Current version is 1.2. It was developed for Lua 5.0.</p>
<p>Version 1.2 follows the
<a href="http://www.keplerproject.org/compat">package model</a>
for Lua 5.1 (see section <a href="manual.html#installation">Installation</a>
for more details).</p>
<p>Current version is 1.2.1. 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> Release 2
a Windows binary version of LuaFileSystem can also be found at the
LuaForge page.</p>
<a href="http://luabinaries.luaforge.net">LuaBinaries</a> 5.1.2 a Windows binary
version of LuaFileSystem can be found at the same LuaForge page.</p>
<h2><a name="history"></a>History</h2>
<dl class="history">
<dt><strong>Version 1.2.1</strong> [08/May/2007]</dt>
<dd>
<ul>
<li>compatible only with Lua 5.1 (Lua 5.0 support was dropped)</li>
</ul>
</dd>
<dt><strong>Version 1.2</strong> [15/Mar/2006]</dt>
<dd>
<ul>
@@ -139,7 +139,7 @@ Comments are welcome!</p>
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>$Id: index.html,v 1.30 2006/03/15 16:44:04 carregal Exp $</small></p>
<p><small>$Id: index.html,v 1.30.2.1 2007/05/08 21:35:11 carregal Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

View File

@@ -39,6 +39,7 @@
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#building">Building</a></li>
<li><a href="manual.html#installation">Installation</a></li>
<li><a href="manual.html#reference">Reference</a></li>
</ul>
@@ -84,7 +85,7 @@ Ierusalimschy, Andr&eacute; Carregal and Tom&aacute;s Guisasola.
The implementation is not derived from licensed software.</p>
<hr/>
<p>Copyright &copy; 2004-2006 The Kepler Project.</p>
<p>Copyright &copy; 2004-2007 The Kepler Project.</p>
<p>Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -113,7 +114,7 @@ SOFTWARE.</p>
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>$Id: license.html,v 1.9 2006/03/14 14:07:55 carregal Exp $</small></p>
<p><small>$Id: license.html,v 1.9.2.1 2007/05/08 21:35:11 carregal Exp $</small></p>
</div><!-- id="about" -->
</div><!-- id="container" -->

View File

@@ -37,6 +37,7 @@
<li><strong>Manual</strong>
<ul>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#building">Building</a></li>
<li><a href="manual.html#installation">Installation</a></li>
<li><a href="manual.html#reference">Reference</a></li>
</ul>
@@ -63,16 +64,26 @@ systems offered by the standard Lua distribution.</p>
<p>LuaFileSystem offers a portable way to access
the underlying directory structure and file attributes.</p>
<h2><a name="building"></a>Building</h2>
<p>
LuaFileSystem should be built with Lua 5.1 so the language library
and header files for the target version must be installed properly.
</p>
<p>
LuaFileSystem offers a Makefile and a separate configuration file,
<code>config</code>,
which should be edited to suit your installation before runnig
<code>make</code>.
The file has some definitions like paths to the external libraries,
compiler options and the like.
</p>
<h2><a name="installation"></a>Installation</h2>
<p>LuaFileSystem follows the
<a href="http://www.keplerproject.org/compat/">package model</a>
for Lua 5.1, therefore it should be "installed". Refer to
<a href="http://www.keplerproject.org/compat/manual.html#configuration">
Compat-5.1 configuration</a> section about how to install the compiled
binary properly.
The compiled binary should be copied to a directory in your
<code>LUA_CPATH</code>.</p>
<p>The LuaFileSystem compiled binary should be copied to a directory in your
<a href="http://www.lua.org/manual/5.1/manual.html#pdf-package.cpath">C path</a>.</p>
<p>Windows users can use the binary version of LuaFileSystem
(<code>lfs.dll</code>) available at
@@ -94,7 +105,9 @@ LuaFileSystem offers the following functions:
<code>lfs.attributes(filepath).aname</code>, but the table is not created
and only one attribute is retrieved from the O.S.).
The attributes are described as follows;
attribute <code>mode</code> is a string, all the others are numbers:
attribute <code>mode</code> is a string, all the others are numbers,
and the time related attributes use the same time reference of
<a href="http://www.lua.org/manual/5.1/manual.html#pdf-os.time"><code>os.time</code></a>:
<dl>
<dt><strong><code>dev</code></strong></dt>
<dd>on Unix systems, this represents the device that the inode resides on. On Windows systems,
@@ -215,7 +228,7 @@ LuaFileSystem offers the following functions:
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>$Id: manual.html,v 1.30 2006/03/15 16:44:04 carregal Exp $</small></p>
<p><small>$Id: manual.html,v 1.30.2.2 2007/05/08 21:35:11 carregal Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->

View File

@@ -14,7 +14,7 @@
** lfs.touch (filepath [, atime [, mtime]])
** lfs.unlock (fh)
**
** $Id: lfs.c,v 1.32 2006/03/14 13:39:38 tomas Exp $
** $Id: lfs.c,v 1.32.2.1 2007/05/08 21:35:10 carregal Exp $
*/
#include <errno.h>
@@ -39,8 +39,6 @@
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include "compat-5.1.h"
#include "lfs.h"
/* Define 'strerror' for systems that do not implement it */
@@ -556,13 +554,13 @@ static int file_info (lua_State *L) {
*/
static void set_info (lua_State *L) {
lua_pushliteral (L, "_COPYRIGHT");
lua_pushliteral (L, "Copyright (C) 2003-2006 Kepler Project");
lua_pushliteral (L, "Copyright (C) 2003-2007 Kepler Project");
lua_settable (L, -3);
lua_pushliteral (L, "_DESCRIPTION");
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.2");
lua_pushliteral (L, "LuaFileSystem 1.2.1");
lua_settable (L, -3);
}

5
src/lfs.def Normal file
View File

@@ -0,0 +1,5 @@
LIBRARY lfs.dll
DESCRIPTION "LuaFileSystem"
VERSION 1.2.1
EXPORTS
luaopen_lfs

View File

@@ -1,10 +1,11 @@
#!/usr/local/bin/lua50
#!/usr/local/bin/lua5.1
local tmp = "/tmp"
local sep = "/"
local upper = ".."
require"lfs"
print (lfs._VERSION)
function attrdir (path)
for file in lfs.dir(path) do