mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-23 19:43:06 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c6e1b013c | ||
|
|
68c624c686 | ||
|
|
41e59da31b | ||
|
|
842505b6a3 | ||
|
|
3e879ffba1 | ||
|
|
4f7e1b5a49 | ||
|
|
a5336d294d | ||
|
|
6048863a96 | ||
|
|
1a61e5284d | ||
|
|
7cb7d86dc4 | ||
|
|
94700f7c18 | ||
|
|
53d2acc517 | ||
|
|
6b11508ea9 | ||
|
|
58cf8c9449 | ||
|
|
04ba8d686a | ||
|
|
04bdaf9a1e | ||
|
|
1dfb8c41e8 | ||
|
|
37d8524e7e | ||
|
|
e5f06c270a | ||
|
|
884b52a3b2 | ||
|
|
1b5073419f | ||
|
|
fe964e013d | ||
|
|
12d1692f14 | ||
|
|
de87218e97 | ||
|
|
a23cadf009 |
@@ -6,7 +6,6 @@ env:
|
|||||||
- LUA="lua 5.1"
|
- LUA="lua 5.1"
|
||||||
- LUA="lua 5.2"
|
- LUA="lua 5.2"
|
||||||
- LUA="lua 5.3"
|
- LUA="lua 5.3"
|
||||||
- LUA="luajit 2.0"
|
|
||||||
- LUA="luajit 2.1"
|
- LUA="luajit 2.1"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
@@ -20,7 +19,7 @@ before_install:
|
|||||||
- luarocks install luacov-coveralls --server=https://luarocks.org/dev --deps-mode=none
|
- luarocks install luacov-coveralls --server=https://luarocks.org/dev --deps-mode=none
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"
|
- luarocks make CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- lua -lluacov tests/test.lua
|
- lua -lluacov tests/test.lua
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -12,14 +12,14 @@ OBJS= src/$T.o
|
|||||||
lib: src/lfs.so
|
lib: src/lfs.so
|
||||||
|
|
||||||
src/lfs.so: $(OBJS)
|
src/lfs.so: $(OBJS)
|
||||||
MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
|
MACOSX_DEPLOYMENT_TARGET=$(MACOSX_DEPLOYMENT_TARGET); export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
|
||||||
|
|
||||||
test: lib
|
test: lib
|
||||||
LUA_CPATH=./src/?.so lua tests/test.lua
|
LUA_CPATH=./src/?.so lua tests/test.lua
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(LUA_LIBDIR)
|
mkdir -p $(DESTDIR)$(LUA_LIBDIR)
|
||||||
cp src/lfs.so $(LUA_LIBDIR)
|
cp src/lfs.so $(DESTDIR)$(LUA_LIBDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f src/lfs.so $(OBJS)
|
rm -f src/lfs.so $(OBJS)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# LuaFileSystem - File System Library for Lua
|
# LuaFileSystem - File System Library for Lua
|
||||||
|
|
||||||
Copyright 2003-2017 Kepler Project
|
Copyright 2003-2020 Kepler Project
|
||||||
|
|
||||||
https://keplerproject.github.io/luafilesystem
|
https://keplerproject.github.io/luafilesystem
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ environment:
|
|||||||
- LUA: "lua 5.1"
|
- LUA: "lua 5.1"
|
||||||
- LUA: "lua 5.2 --compat none"
|
- LUA: "lua 5.2 --compat none"
|
||||||
- LUA: "lua 5.3 --compat none"
|
- LUA: "lua 5.3 --compat none"
|
||||||
- LUA: "luajit 2.0"
|
|
||||||
- LUA: "luajit 2.1"
|
- LUA: "luajit 2.1"
|
||||||
|
|
||||||
# Abuse this section so we can have a matrix with different Compiler versions
|
# Abuse this section so we can have a matrix with different Compiler versions
|
||||||
@@ -30,7 +29,7 @@ before_build:
|
|||||||
- echo "Installing external deps"
|
- echo "Installing external deps"
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- luarocks make rockspecs/luafilesystem-cvs-3.rockspec
|
- luarocks make
|
||||||
|
|
||||||
before_test:
|
before_test:
|
||||||
|
|
||||||
|
|||||||
12
config
12
config
@@ -3,21 +3,25 @@
|
|||||||
# Default installation prefix
|
# Default installation prefix
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
|
|
||||||
|
LUA_VERSION = 5.1
|
||||||
|
|
||||||
# System's libraries directory (where binary libraries are installed)
|
# System's libraries directory (where binary libraries are installed)
|
||||||
LUA_LIBDIR= $(PREFIX)/lib/lua/5.1
|
LUA_LIBDIR= $(PREFIX)/lib/lua/$(LUA_VERSION)
|
||||||
|
|
||||||
# Lua includes directory
|
# Lua includes directory
|
||||||
LUA_INC= $(PREFIX)/include
|
LUA_INC += -I$(PREFIX)/include
|
||||||
|
LUA_INC += -I/usr/include/lua$(LUA_VERSION) -I/usr/include/lua/$(LUA_VERSION)
|
||||||
|
|
||||||
# OS dependent
|
# OS dependent
|
||||||
LIB_OPTION= -shared #for Linux
|
LIB_OPTION= -shared #for Linux
|
||||||
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
|
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
|
||||||
|
|
||||||
LIBNAME= $T.so.$V
|
# Minimum runtime OS version on macOS
|
||||||
|
MACOSX_DEPLOYMENT_TARGET= 10.5
|
||||||
|
|
||||||
# Compilation directives
|
# Compilation directives
|
||||||
WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
|
WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
|
||||||
INCS= -I$(LUA_INC)
|
INCS= $(LUA_INC)
|
||||||
CFLAGS= $(WARN) $(INCS)
|
CFLAGS= $(WARN) $(INCS)
|
||||||
CC= gcc
|
CC= gcc
|
||||||
|
|
||||||
|
|||||||
10
config.win
10
config.win
@@ -1,14 +1,14 @@
|
|||||||
|
LUA_VERSION= 5.1
|
||||||
|
|
||||||
# Installation directories
|
# Installation directories
|
||||||
# System's libraries directory (where binary libraries are installed)
|
# System's libraries directory (where binary libraries are installed)
|
||||||
LUA_LIBDIR= "c:\lua5.1"
|
LUA_LIBDIR= "c:\lua$(LUA_VERSION)"
|
||||||
|
|
||||||
# Lua includes directory
|
# Lua includes directory
|
||||||
LUA_INC= "c:\lua5.1\include"
|
LUA_INC= "c:\lua$(LUA_VERSION)\include"
|
||||||
|
|
||||||
# Lua library
|
# Lua library
|
||||||
LUA_LIB= "c:\lua5.1\lua5.1.lib"
|
LUA_LIB= "c:\lua$(LUA_VERSION)\lua$(LUA_VERSION).lib"
|
||||||
|
|
||||||
LIBNAME= $T.dll
|
|
||||||
|
|
||||||
# Compilation directives
|
# Compilation directives
|
||||||
WARN= /O2
|
WARN= /O2
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ 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.7.0. It works with Lua 5.1, 5.2 and 5.3, and it runs on various
|
<p>Current version is 1.8.0. It works with Lua 5.1, 5.2, 5.3 and 5.4, and it runs on various
|
||||||
flavors of Unix (including Linux, BSDs, macOS) and Windows.</p>
|
flavors of Unix (including Linux, BSDs, macOS) and Windows.</p>
|
||||||
|
|
||||||
<h2><a name="download"></a>Download</h2>
|
<h2><a name="download"></a>Download</h2>
|
||||||
@@ -86,6 +86,15 @@ $ luarocks install luafilesystem
|
|||||||
<h2><a name="history"></a>History</h2>
|
<h2><a name="history"></a>History</h2>
|
||||||
|
|
||||||
<dl class="history">
|
<dl class="history">
|
||||||
|
<dt><strong>Version 1.8.0</strong> [22/Apr/2020]</dt>
|
||||||
|
<dd><ul>
|
||||||
|
<li>Lua 5.4 support</li>
|
||||||
|
<li>lfs.link and lfs.symlinkattributes now work on Windows</li>
|
||||||
|
<li>MACOSX_DEPLOYMENT_TARGET is configurable in the Makefile</li>
|
||||||
|
<li>Fallback to _POSIX_PATH_MAX when MAXPATHLEN is not avaliable</li>
|
||||||
|
<li>Fixed memory leak in case of realloc failure</li>
|
||||||
|
</ul></dd>
|
||||||
|
|
||||||
<dt><strong>Version 1.7.0</strong> [15/Sep/2017]</dt>
|
<dt><strong>Version 1.7.0</strong> [15/Sep/2017]</dt>
|
||||||
<dd><ul>
|
<dd><ul>
|
||||||
<li>symlinkattributes function now provides 'target' field, containing name of the file that the symlink points to.</li>
|
<li>symlinkattributes function now provides 'target' field, containing name of the file that the symlink points to.</li>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ Ierusalimschy, André Carregal and Tomás Guisasola.
|
|||||||
The implementation is not derived from licensed software.</p>
|
The implementation is not derived from licensed software.</p>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<p>Copyright © 2003 - 2017 Kepler Project.</p>
|
<p>Copyright © 2003 - 2020 Kepler Project.</p>
|
||||||
|
|
||||||
<p>Permission is hereby granted, free of charge, to any person
|
<p>Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation
|
obtaining a copy of this software and associated documentation
|
||||||
|
|||||||
@@ -102,15 +102,15 @@ LuaFileSystem offers the following functions:
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl class="reference">
|
<dl class="reference">
|
||||||
<dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, aname | atable])</code></strong></dt>
|
<dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, request_name | result_table])</code></strong></dt>
|
||||||
<dd>Returns a table with the file attributes corresponding to
|
<dd>Returns a table with the file attributes corresponding to
|
||||||
<code>filepath</code> (or <code>nil</code> followed by an error message and a system-dependent error code
|
<code>filepath</code> (or <code>nil</code> followed by an error message and a system-dependent error code
|
||||||
in case of error).
|
in case of error).
|
||||||
If the second optional argument is given and is a string, then only the value of the
|
If the second optional argument is given and is a string, then only the value of the
|
||||||
named attribute is returned (this use is equivalent to
|
named attribute is returned (this use is equivalent to
|
||||||
<code>lfs.attributes(filepath)[aname]</code>, but the table is not created
|
<code>lfs.attributes(filepath)[request_name]</code>, but the table is not created
|
||||||
and only one attribute is retrieved from the O.S.).
|
and only one attribute is retrieved from the O.S.).
|
||||||
if a table is passed as the second argument, it is filled with attributes and returned instead of a new table.
|
if a table is passed as the second argument, it (<code>result_table</code>) is filled with attributes and returned instead of a new table.
|
||||||
The attributes are described as follows;
|
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
|
and the time related attributes use the same time reference of
|
||||||
@@ -239,7 +239,7 @@ LuaFileSystem offers the following functions:
|
|||||||
setting the mode has no effect, and the mode is always returned as <code>binary</code>.
|
setting the mode has no effect, and the mode is always returned as <code>binary</code>.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><a name="symlinkattributes"></a><strong><code>lfs.symlinkattributes (filepath [, aname])</code></strong></dt>
|
<dt><a name="symlinkattributes"></a><strong><code>lfs.symlinkattributes (filepath [, request_name])</code></strong></dt>
|
||||||
<dd>Identical to <a href="#attributes">lfs.attributes</a> except that
|
<dd>Identical to <a href="#attributes">lfs.attributes</a> except that
|
||||||
it obtains information about the link itself (not the file it refers to).
|
it obtains information about the link itself (not the file it refers to).
|
||||||
It also adds a <strong><code>target</code></strong> field, containing
|
It also adds a <strong><code>target</code></strong> field, containing
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package = "LuaFileSystem"
|
package = "luafilesystem"
|
||||||
version = "1.7.0-1"
|
version = "scm-1"
|
||||||
source = {
|
source = {
|
||||||
url = "git://github.com/keplerproject/luafilesystem",
|
url = "git://github.com/keplerproject/luafilesystem"
|
||||||
tag = "v1_7_0",
|
|
||||||
}
|
}
|
||||||
description = {
|
description = {
|
||||||
summary = "File System Library for the Lua Programming Language",
|
summary = "File System Library for the Lua Programming Language",
|
||||||
@@ -12,7 +11,7 @@ description = {
|
|||||||
distribution. LuaFileSystem offers a portable way to access the
|
distribution. LuaFileSystem offers a portable way to access the
|
||||||
underlying directory structure and file attributes.
|
underlying directory structure and file attributes.
|
||||||
]],
|
]],
|
||||||
license = "MIT/X11",
|
license = "MIT/X11"
|
||||||
}
|
}
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"lua >= 5.1"
|
"lua >= 5.1"
|
||||||
@@ -23,6 +22,7 @@ build = {
|
|||||||
lfs = "src/lfs.c"
|
lfs = "src/lfs.c"
|
||||||
},
|
},
|
||||||
copy_directories = {
|
copy_directories = {
|
||||||
"doc", "tests"
|
"doc",
|
||||||
|
"tests"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.3.0-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.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 = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_INC = "$(LUA_INCDIR)",
|
|
||||||
LIB_OPTION = "$(LIBFLAG)"
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.0-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.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 = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_INC = "$(LUA_INCDIR)",
|
|
||||||
LIB_OPTION = "$(LIBFLAG)"
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.0-2"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.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)",
|
|
||||||
},
|
|
||||||
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)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
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)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.1rc1-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luafilesystem.luaforge.net/luafilesystem-1.4.1rc1.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)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.4.2-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3931/luafilesystem-1.4.2.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,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.5.0-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "http://cloud.github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.5.0.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" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.6.0-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.0.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 = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.6.1-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.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 = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.6.2-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.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 = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.6.3-1"
|
|
||||||
source = {
|
|
||||||
url = "git://github.com/keplerproject/luafilesystem",
|
|
||||||
tag = "v_1_6_3",
|
|
||||||
}
|
|
||||||
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.
|
|
||||||
]],
|
|
||||||
license = "MIT/X11",
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
type = "builtin",
|
|
||||||
modules = {
|
|
||||||
lfs = "src/lfs.c"
|
|
||||||
},
|
|
||||||
copy_directories = {
|
|
||||||
"doc", "tests"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "cvs-1"
|
|
||||||
source = {
|
|
||||||
url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem",
|
|
||||||
cvs_tag = "HEAD"
|
|
||||||
}
|
|
||||||
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)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
win32 = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib",
|
|
||||||
CFLAGS = "$(CFLAGS) /I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)",
|
|
||||||
LUA_DIR = "$(LUADIR)",
|
|
||||||
BIN_DIR = "$(BINDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "cvs-2"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "git://github.com/keplerproject/luafilesystem.git",
|
|
||||||
}
|
|
||||||
|
|
||||||
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,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "cvs-3"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "git://github.com/keplerproject/luafilesystem.git",
|
|
||||||
}
|
|
||||||
|
|
||||||
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, < 5.4"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
LIBRARY lfs.dll
|
LIBRARY lfs.dll
|
||||||
VERSION 1.6
|
VERSION 1.8
|
||||||
EXPORTS
|
EXPORTS
|
||||||
luaopen_lfs
|
luaopen_lfs
|
||||||
|
|||||||
27
src/lfs.h
27
src/lfs.h
@@ -1,33 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
** LuaFileSystem
|
** LuaFileSystem
|
||||||
** Copyright Kepler Project 2003 - 2017 (http://keplerproject.github.io/luafilesystem)
|
** Copyright Kepler Project 2003 - 2020
|
||||||
|
** (http://keplerproject.github.io/luafilesystem)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define 'chdir' for systems that do not implement it */
|
/* Define 'chdir' for systems that do not implement it */
|
||||||
#ifdef NO_CHDIR
|
#ifdef NO_CHDIR
|
||||||
#define chdir(p) (-1)
|
#define chdir(p) (-1)
|
||||||
#define chdir_error "Function 'chdir' not provided by system"
|
#define chdir_error "Function 'chdir' not provided by system"
|
||||||
#else
|
#else
|
||||||
#define chdir_error strerror(errno)
|
#define chdir_error strerror(errno)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define chdir(p) (_chdir(p))
|
#define chdir(p) (_chdir(p))
|
||||||
#define getcwd(d, s) (_getcwd(d, s))
|
#define getcwd(d, s) (_getcwd(d, s))
|
||||||
#define rmdir(p) (_rmdir(p))
|
#define rmdir(p) (_rmdir(p))
|
||||||
#define LFS_EXPORT __declspec (dllexport)
|
#define LFS_EXPORT __declspec (dllexport)
|
||||||
#ifndef fileno
|
#ifndef fileno
|
||||||
#define fileno(f) (_fileno(f))
|
#define fileno(f) (_fileno(f))
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define LFS_EXPORT
|
#define LFS_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LFS_EXPORT int luaopen_lfs (lua_State *L);
|
LFS_EXPORT int luaopen_lfs(lua_State * L);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ local tmp = "/tmp"
|
|||||||
local sep = string.match (package.config, "[^\n]+")
|
local sep = string.match (package.config, "[^\n]+")
|
||||||
local upper = ".."
|
local upper = ".."
|
||||||
|
|
||||||
|
local is_unix = package.config:sub(1,1) == "/"
|
||||||
|
|
||||||
local lfs = require"lfs"
|
local lfs = require"lfs"
|
||||||
print (lfs._VERSION)
|
print (lfs._VERSION)
|
||||||
|
|
||||||
@@ -60,6 +62,8 @@ if not attrib then
|
|||||||
error ("could not get attributes of file `"..tmpdir.."':\n"..errmsg)
|
error ("could not get attributes of file `"..tmpdir.."':\n"..errmsg)
|
||||||
end
|
end
|
||||||
local f = io.open(tmpfile, "w")
|
local f = io.open(tmpfile, "w")
|
||||||
|
local data = "hello, file!"
|
||||||
|
f:write(data)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
io.write(".")
|
io.write(".")
|
||||||
@@ -87,14 +91,42 @@ assert (new_att.modification == testdate1, "could not set modification time")
|
|||||||
io.write(".")
|
io.write(".")
|
||||||
io.flush()
|
io.flush()
|
||||||
|
|
||||||
-- Checking link (does not work on Windows)
|
|
||||||
if lfs.link (tmpfile, "_a_link_for_test_", true) then
|
if lfs.link (tmpfile, "_a_link_for_test_", true) then
|
||||||
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
||||||
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
||||||
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
|
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
|
||||||
assert (lfs.symlinkattributes("_a_link_for_test_", "target") == tmpfile)
|
assert (lfs.symlinkattributes("_a_link_for_test_", "target") == tmpfile)
|
||||||
|
|
||||||
|
assert (lfs.symlinkattributes(tmpfile).mode == "file")
|
||||||
|
|
||||||
assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
|
assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
|
||||||
assert (lfs.attributes (tmpfile, "nlink") == 2)
|
assert (lfs.symlinkattributes"_a_hard_link_for_test_".mode == "file")
|
||||||
|
|
||||||
|
local fd = io.open(tmpfile)
|
||||||
|
assert(fd:read("*a") == data)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open("_a_link_for_test_")
|
||||||
|
assert(fd:read("*a") == data)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open("_a_hard_link_for_test_")
|
||||||
|
assert(fd:read("*a") == data)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open("_a_hard_link_for_test_", "w+")
|
||||||
|
local data2 = "write in hard link"
|
||||||
|
fd:write(data2)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open(tmpfile)
|
||||||
|
assert(fd:read("*a") == data2)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
if is_unix then
|
||||||
|
assert (lfs.attributes (tmpfile, "nlink") == 2)
|
||||||
|
end
|
||||||
|
|
||||||
assert (os.remove"_a_link_for_test_")
|
assert (os.remove"_a_link_for_test_")
|
||||||
assert (os.remove"_a_hard_link_for_test_")
|
assert (os.remove"_a_hard_link_for_test_")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user