From 8332f1ab9ef64d1c8faab97d31a026576490b510 Mon Sep 17 00:00:00 2001 From: Fabio Mascarenhas Date: Tue, 20 Oct 2009 19:03:43 -0200 Subject: [PATCH] first pages commit for luafilesystem --- examples.html | 103 ++++++++++++++++++ index.html | 192 ++++++++++++++++++++++++++++++++ license.html | 122 +++++++++++++++++++++ luafilesystem.png | Bin 0 -> 8535 bytes manual.html | 271 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 688 insertions(+) create mode 100644 examples.html create mode 100644 index.html create mode 100644 license.html create mode 100644 luafilesystem.png create mode 100644 manual.html diff --git a/examples.html b/examples.html new file mode 100644 index 0000000..746df62 --- /dev/null +++ b/examples.html @@ -0,0 +1,103 @@ + + + + LuaFileSystem + + + + + + +
+ +
+ +
LuaFileSystem
+
File System Library for the Lua Programming Language
+
+ +
+ + + +
+ +

Examples

+ +

Directory iterator

+ +

The following example iterates over a directory and recursively lists the +attributes for each file inside it.

+ +
+require"lfs"
+
+function attrdir (path)
+    for file in lfs.dir(path) do
+        if file ~= "." and file ~= ".." then
+            local f = path..'/'..file
+            print ("\t "..f)
+            local attr = lfs.attributes (f)
+            assert (type(attr) == "table")
+            if attr.mode == "directory" then
+                attrdir (f)
+            else
+                for name, value in pairs(attr) do
+                    print (name, value)
+                end
+            end
+        end
+    end
+end
+
+attrdir (".")
+
+ +
+ +
+ +
+

Valid XHTML 1.0!

+

$Id: examples.html,v 1.8 2007/12/14 15:28:04 carregal Exp $

+
+ +
+ + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..43edefc --- /dev/null +++ b/index.html @@ -0,0 +1,192 @@ + + + + LuaFileSystem + + + + + + +
+ +
+ +
LuaFileSystem
+
File System Library for the Lua Programming Language
+
+ +
+ + + +
+ +

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.5.0. It was developed for Lua 5.1.

+ +

Download

+ +

LuaFileSystem source can be downloaded from its +Github +page.

+ +

History

+ +
+
Version 1.5.0 [20/Oct/2009]
+
  • Added explicit next and close methods to second return value of lfs.dir +(the directory object), for explicit iteration or explicit closing.
  • +
  • Added directory locking via lfs.lock_dir function (see the manual).
  • +
    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]
    +
    + +
    + +
    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]
    +
    + +
    + +
    Version 1.1 [30/May/2005]
    +
    + +
    + +
    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. LuaFileSystem is currently maintained by Fábio Mascarenhas.

    + +

    Contact us

    + +

    For more information please +contact us. +Comments are welcome!

    + +

    You can also reach other Kepler developers and users on the Kepler Project +mailing list.

    + +
    + +
    + +
    +

    Valid XHTML 1.0!

    +

    $Id: index.html,v 1.44 2009/02/04 21:21:33 carregal Exp $

    +
    + +
    + + + diff --git a/license.html b/license.html new file mode 100644 index 0000000..4ecad4b --- /dev/null +++ b/license.html @@ -0,0 +1,122 @@ + + + + LuaFileSystem + + + + + + +
    + +
    + +
    LuaFileSystem
    +
    File System Library for the Lua Programming Language
    +
    + +
    + + + +
    + +

    License

    + +

    +LuaFileSystem is free software: it can be used for both academic +and commercial purposes at absolutely no cost. There are no +royalties or GNU-like "copyleft" restrictions. LuaFileSystem +qualifies as +Open Source +software. +Its licenses are compatible with +GPL. +LuaFileSystem is not in the public domain and the +Kepler Project +keep its copyright. +The legal details are below. +

    + +

    The spirit of the license is that you are free to use +LuaFileSystem for any purpose at no cost without having to ask us. +The only requirement is that if you do use LuaFileSystem, then you +should give us credit by including the appropriate copyright notice +somewhere in your product or its documentation.

    + +

    The LuaFileSystem library is designed and implemented by Roberto +Ierusalimschy, André Carregal and Tomás Guisasola. +The implementation is not derived from licensed software.

    + +
    +

    Copyright © 2003 Kepler Project.

    + +

    Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:

    + +

    The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software.

    + +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.

    + +
    + +
    + +
    +

    Valid XHTML 1.0!

    +

    $Id: license.html,v 1.13 2008/02/11 22:42:21 carregal Exp $

    +
    + +
    + + + diff --git a/luafilesystem.png b/luafilesystem.png new file mode 100644 index 0000000000000000000000000000000000000000..e1dd8c65b5211ba5dd37f2e86da987fdd517d6c6 GIT binary patch literal 8535 zcmX|HWjvj4AHSLIW~Ld_c9`y-9%i~tP3P1xaWFl@Oig!B593TtcMUV$lhdB-|K_vubSnPD0R77LtEJjNJ~5XFio48jap#gTF&V>n*LS$ctAksetdeg{te{@40W^;3G{ zPW2ANlX?Zeu?QGYIT#p{1{rjMi9Qe^2CuKJ{B>}ipAUZ@Jv{w~sX6PvU;oeWkb3#7 z(np35FH|Z`)K%ve<$n8yJ(zt%6GiPQ9LN0qr4FPsNUsLXRGJL*_owYt@v()K+(Dtl zSZI0oFFBGkGc(FMd5BvEz(^9@c5b^?Yz zKK}|-Q!y|xpR;_><-i9UA)(Uo?Z!~L8f%h9k&lm$n6U6*h6rhVucjByS3Y$|2oE_l zG!z~lZen7>LSnx?UU0H8gj{jO!;oVk>F(}+QKDO*{dRl&F(qYcz2gi?)Q_J(f1aLt zQba%V*ieI{9UUFj)nki_*wWO7`}&G2D)6zf**Q5w8Tw{sQion^CS5&^y@IF^j~+b= zmt};$-Dz%hJk)o=vN;gc(%L%Z;02CaCQpJzhV%I8)3Nb!62yv2$8AG%^TU!Sthw4H z*Vjs6vg`zyZ=ATdJaGtY^}9c_px_Y_rY0xXH#GclZTj+s0SP((J?|_7#bRCYs(f*Fk;nKS64SQ^sF9DPftU^@7|$^W>)Hz^;_2#6%`p)DEh&` ztl{F~LQs5fT|+}dZLO^3>X9!U9bKOh1Ub}G6Bmue#5}1q4Rl*q@sg48H(RdWXo<$< z7SCvVds4n-=Yoo&vkQBOT3l8((AW1xyM%^7=?R%>d%)YXohe*O9^De%%gal0a&n_a z=kC>`JoIYoev%xmPf1D4$to692#Z-TTfK3#x*W;MEbqH5U%h%|WMtHAOh-f{%|en` z+kPx`dX~J!*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9#W&ZWj@D|0$Wa2YJ+{A_m7D2r4jS?rtm)>gkSHYYiKC$;HSI4h=c2_QWb?6YwUn^YiZlsB49Hbbs3fRofJa<*lu)74WTNn?u%Q zgA&8yjy1A(wIDwqNW1pCt6c=a``*zRp@3DzMUZ6@(tZ8(C$4Kcg_^iCF7Et&?Ag>R z%ueM~f}}J9QGP)IXpvPIH;;1>b0qIvUA6bdi-B0TwA3#>Jv=k>K}+F;JkxM@_vfM4 zgIW80wsEU~k^z+RIXB9wgG}I+G}I!(1b(vUv~$MutB3z zRykUHb2p}&7oP=gK4+1VLLrFW+*kiJ|oGHQzWT2II*d5nRj#R7>wHg;N*w|z*k zg|Dlt*8RJ8iu}*j6AUYO*x8%m_wDudXP=)r8k?A~trRFeKvt`6qwbWo0F>5FjfDlR)aFlGi^t$i>OYOcDip&ULScfZctn z;pWIwmo{mvWGdgG?y8n<=rlqa(Z1 z+_l+wXfY*)qTX=-;6PHnka^+{^VdJ1`L@5$ozxEkZeQ^wDzQU;+hHs;R3?yr6aDqQ zX%D;>KsR6@Vqs%@0D-<~XeX6b0rGYFN`fXoEYLAHXntYgF-epfEAX!>1@2?H3ZF~A z=yIT=zN@c)7A~81oJh_A*G0L3Bl8KG@2tiD{{+GPgO6mJs0j~RZoq>M;+_ino^mcu zPBzY-5W{mP3tJloTN`H^cMDG&YX-}=3`!a=8I + + + LuaFileSystem + + + + + + +
    + +
    + +
    LuaFileSystem
    +
    File System Library for the Lua Programming Language
    +
    + +
    + + + +
    + +

    Introduction

    + +

    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.

    + +

    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 running +make. +The file has some definitions like paths to the external libraries, +compiler options and the like. +

    + +

    On Windows, the C runtime used to compile LuaFileSystem must be the same +runtime that Lua uses, or some LuaFileSystem functions will not work.

    + +

    Installation

    + +

    The easiest way to install LuaFileSystem is to use LuaRocks:

    + +
    +luarocks install luafilesystem
    +
    + +

    If you prefer to install LuaFileSystem manually, the compiled binary should be copied to a directory in your +C path.

    + +

    Reference

    + +

    +LuaFileSystem offers the following functions: +

    + +
    +
    lfs.attributes (filepath [, aname])
    +
    Returns a table with the file attributes corresponding to + filepath (or nil followed by an error message + in case of error). + If the second optional argument is given, then only the value of the + named attribute is returned (this use is equivalent to + lfs.attributes(filepath).aname, but the table is not created + and only one attribute is retrieved from the O.S.). + 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: +
    +
    dev
    +
    on Unix systems, this represents the device that the inode resides on. On Windows systems, + represents the drive number of the disk containing the file
    + +
    ino
    +
    on Unix systems, this represents the inode number. On Windows systems this has no meaning
    + +
    mode
    +
    string representing the associated protection mode (the values could be + file, directory, link, socket, + named pipe, char device, block device or + other)
    + +
    nlink
    +
    number of hard links to the file
    + +
    uid
    +
    user-id of owner (Unix only, always 0 on Windows)
    + +
    gid
    +
    group-id of owner (Unix only, always 0 on Windows)
    + +
    rdev
    +
    on Unix systems, represents the device type, for special file inodes. + On Windows systems represents the same as dev
    + +
    access
    +
    time of last access
    + +
    modification
    +
    time of last data modification
    + +
    change
    +
    time of last file status change
    + +
    size
    +
    file size, in bytes
    + +
    blocks
    +
    block allocated for file; (Unix only)
    + +
    blksize
    +
    optimal file system I/O blocksize; (Unix only)
    +
    + This function uses stat internally thus if the given + filepath is a symbolic link, it is followed (if it points to + another link the chain is followed recursively) and the information + is about the file it refers to. + To obtain information about the link itself, see function + lfs.symlinkattributes. +
    + +
    lfs.chdir (path)
    +
    Changes the current working directory to the given + path.
    + Returns true in case of success or nil plus an + error string.
    + +
    lfs.lock_dir(path, [seconds_stale])
    +
    Creates a lockfile (called lockfile.lfs) in path if it does not + exist and returns the lock. If the lock already exists checks it + it's stale, using the second parameter (default for the second + parameter is INT_MAX, which in practice means the lock will never + be stale. To free the the lock call lock:free().
    + In case of any errors it returns nil and the error message. In + particular, if the lock exists and is not stale it returns the + "File exists" message.
    + +
    lfs.currentdir ()
    +
    Returns a string with the current working directory or nil + plus an error string.
    + +
    iter, dir_obj = lfs.dir (path)
    +
    + Lua iterator over the entries of a given directory. + Each time the iterator is called with dir_obj it returns a directory entry's name as a string, or + nil if there are no more entries. You can also iterate by calling dir_obj:next(), and + explicitly close the directory before the iteration finished with dir_obj:close(). + Raises an error if path is not a directory. +
    + +
    lfs.lock (filehandle, mode[, start[, length]])
    +
    Locks a file or a part of it. This function works on open files; the + file handle should be specified as the first argument. + The string mode could be either + r (for a read/shared lock) or w (for a + write/exclusive lock). The optional arguments start + and length can be used to specify a starting point and + its length; both should be numbers.
    + Returns true if the operation was successful; in + case of error, it returns nil plus an error string. +
    + +
    lfs.mkdir (dirname)
    +
    Creates a new directory. The argument is the name of the new + directory.
    + Returns true if the operation was successful; + in case of error, it returns nil plus an error string. +
    + +
    lfs.rmdir (dirname)
    +
    Removes an existing directory. The argument is the name of the directory.
    + Returns true if the operation was successful; + in case of error, it returns nil plus an error string.
    + +
    lfs.setmode (file, mode)
    +
    Sets the writing mode for a file. The mode string can be either binary or text. + Returns the previous mode string for the file. This function is only available in Windows, so you may want to make sure that + lfs.setmode exists before using it. +
    + +
    lfs.symlinkattributes (filepath [, aname])
    +
    Identical to lfs.attributes except that + it obtains information about the link itself (not the file it refers to). + This function is not available in Windows so you may want to make sure that + lfs.symlinkattributes exists before using it. +
    + +
    lfs.touch (filepath [, atime [, mtime]])
    +
    Set access and modification times of a file. This function is + a bind to utime function. The first argument is the + filename, the second argument (atime) is the access time, + and the third argument (mtime) is the modification time. + Both times are provided in seconds (which should be generated with + Lua standard function os.time). + If the modification time is omitted, the access time provided is used; + if both times are omitted, the current time is used.
    + Returns true if the operation was successful; + in case of error, it returns nil plus an error string. +
    + +
    lfs.unlock (filehandle[, start[, length]])
    +
    Unlocks a file or a part of it. This function works on + open files; the file handle should be specified as the first + argument. The optional arguments start and + length can be used to specify a starting point and its + length; both should be numbers.
    + Returns true if the operation was successful; + in case of error, it returns nil plus an error string. +
    +
    + +
    + +
    + +
    +

    Valid XHTML 1.0!

    +

    $Id: manual.html,v 1.45 2009/06/03 20:53:55 mascarenhas Exp $

    +
    + +
    + + +