diff --git a/Makefile b/Makefile index f8ee01d..44e3f13 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/Makefile.win b/Makefile.win new file mode 100644 index 0000000..29b7483 --- /dev/null +++ b/Makefile.win @@ -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 diff --git a/README b/README new file mode 100644 index 0000000..f82f97d --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +Overview +-------- + +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 + +Status +------ + +Current version is 1.2.1. It was developed for Lua 5.1. + +Download +-------- + +LuaFileSystem source can be downloaded from its Lua Forge page. If you are using LuaBinaries 5.1.2 a Windows binary version of LuaFileSystem can be found at the same LuaForge page. + +History +------- + +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] + +Credits +------- + +LuaFileSystem was designed by Roberto Ierusalimschy, André Carregal and Tomás Guisasola as part of the Kepler Project, which holds its copyright. + +Contact us +---------- + +For more information please contact us on (info @ keplerproject.org). Comments are welcome! + +You can also reach other Kepler developers and users on the Kepler Project mailing list. \ No newline at end of file diff --git a/config b/config index 5bbd47a..4506259 100644 --- a/config +++ b/config @@ -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 $ diff --git a/config.win b/config.win new file mode 100644 index 0000000..476434d --- /dev/null +++ b/config.win @@ -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 $ diff --git a/doc/us/examples.html b/doc/us/examples.html index 89f7070..6283a88 100644 --- a/doc/us/examples.html +++ b/doc/us/examples.html @@ -39,6 +39,7 @@
  • Manual @@ -94,7 +95,7 @@ attrdir (".")

    Valid XHTML 1.0!

    -

    $Id: examples.html,v 1.5 2006/03/14 14:07:55 carregal Exp $

    +

    $Id: examples.html,v 1.5.2.1 2007/05/08 21:35:11 carregal Exp $

    diff --git a/doc/us/index.html b/doc/us/index.html index 15c954a..5515ebd 100644 --- a/doc/us/index.html +++ b/doc/us/index.html @@ -39,6 +39,7 @@
  • Manual @@ -66,31 +67,30 @@ systems offered by the standard Lua distribution.

    the underlying directory structure and file attributes.

    LuaFileSystem is free software and uses the same -license as Lua 5.0.

    +license as Lua 5.1.

    Status

    -

    Current version is 1.2. It was developed for Lua 5.0.

    - -

    Version 1.2 follows the -package model -for Lua 5.1 (see section Installation -for more details).

    - +

    Current version is 1.2.1. It was developed for Lua 5.1.

    Download

    LuaFileSystem source can be downloaded from its Lua Forge page. If you are using -LuaBinaries Release 2 -a Windows binary version of LuaFileSystem can also be found at the -LuaForge page.

    - +LuaBinaries 5.1.2 a Windows binary +version of LuaFileSystem can be found at the same LuaForge page.

    History

    +
    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]
      @@ -139,7 +139,7 @@ Comments are welcome!

      Valid XHTML 1.0!

      -

      $Id: index.html,v 1.30 2006/03/15 16:44:04 carregal Exp $

      +

      $Id: index.html,v 1.30.2.1 2007/05/08 21:35:11 carregal Exp $

      diff --git a/doc/us/license.html b/doc/us/license.html index 6bb4aaa..879bd3e 100644 --- a/doc/us/license.html +++ b/doc/us/license.html @@ -39,6 +39,7 @@
    • Manual @@ -84,7 +85,7 @@ Ierusalimschy, André Carregal and Tomás Guisasola. The implementation is not derived from licensed software.


      -

      Copyright © 2004-2006 The Kepler Project.

      +

      Copyright © 2004-2007 The Kepler Project.

      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -113,7 +114,7 @@ SOFTWARE.

      Valid XHTML 1.0!

      -

      $Id: license.html,v 1.9 2006/03/14 14:07:55 carregal Exp $

      +

      $Id: license.html,v 1.9.2.1 2007/05/08 21:35:11 carregal Exp $

      diff --git a/doc/us/manual.html b/doc/us/manual.html index 281c06e..23c0104 100644 --- a/doc/us/manual.html +++ b/doc/us/manual.html @@ -37,6 +37,7 @@
    • Manual @@ -63,16 +64,26 @@ systems offered by the standard Lua distribution.

      LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.

      +

      Building

      + +

      +LuaFileSystem should be built with Lua 5.1 so the language library +and header files for the target version must be installed properly. +

      + +

      +LuaFileSystem offers a Makefile and a separate configuration file, +config, +which should be edited to suit your installation before runnig +make. +The file has some definitions like paths to the external libraries, +compiler options and the like. +

      +

      Installation

      -

      LuaFileSystem follows the -package model -for Lua 5.1, therefore it should be "installed". Refer to - -Compat-5.1 configuration section about how to install the compiled -binary properly. -The compiled binary should be copied to a directory in your -LUA_CPATH.

      +

      The LuaFileSystem compiled binary should be copied to a directory in your +C path.

      Windows users can use the binary version of LuaFileSystem (lfs.dll) available at @@ -96,7 +107,7 @@ LuaFileSystem offers the following functions: The attributes are described as follows; attribute mode is a string, all the others are numbers, and the time related attributes use the same time reference of - os.time: + os.time:

      dev
      on Unix systems, this represents the device that the inode resides on. On Windows systems, @@ -217,7 +228,7 @@ LuaFileSystem offers the following functions:

      Valid XHTML 1.0!

      -

      $Id: manual.html,v 1.30.2.1 2006/03/15 20:30:53 carregal Exp $

      +

      $Id: manual.html,v 1.30.2.2 2007/05/08 21:35:11 carregal Exp $

      diff --git a/src/lfs.c b/src/lfs.c index 7c8f62a..5c30163 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -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 @@ -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); } diff --git a/src/lfs.def b/src/lfs.def new file mode 100644 index 0000000..dfe5c59 --- /dev/null +++ b/src/lfs.def @@ -0,0 +1,5 @@ +LIBRARY lfs.dll +DESCRIPTION "LuaFileSystem" +VERSION 1.2.1 +EXPORTS +luaopen_lfs diff --git a/tests/test.lua b/tests/test.lua index 8da5d16..70f90d5 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -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