1 Commits
fix-101 ... 1.7

Author SHA1 Message Date
Hisham
77c0e0f992 Merge branch 'master' into 1.7 2016-10-19 01:35:24 -04:00
11 changed files with 181 additions and 256 deletions

View File

@@ -7,16 +7,16 @@ env:
- LUA="lua 5.2" - LUA="lua 5.2"
- LUA="lua 5.3" - LUA="lua 5.3"
- LUA="luajit 2.0" - LUA="luajit 2.0"
- LUA="luajit 2.1"
before_install: before_install:
- pip install --user cpp-coveralls hererocks - pip install --user cpp-coveralls hererocks
- hererocks env --$LUA --luarocks latest - hererocks env --$LUA --luarocks latest
- export PATH="$PWD/env/bin:$PATH" - export PATH="$PWD/env/bin:$PATH"
- luarocks install Lua-cURL --server=https://luarocks.org/dev
- luarocks install lua-path - luarocks install lua-path
- luarocks install dkjson - luarocks install lua-cjson
- luarocks install luacov - luarocks install luacov
# install luacov-coveralls, but avoid installing luafilesystem # install luacov-coveralls, but avoids installing luafilesystem
- 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:

View File

@@ -18,8 +18,8 @@ test: lib
LUA_CPATH=./src/?.so lua tests/test.lua LUA_CPATH=./src/?.so lua tests/test.lua
install: install:
mkdir -p $(DESTDIR)$(LUA_LIBDIR) mkdir -p $(LUA_LIBDIR)
cp src/lfs.so $(DESTDIR)$(LUA_LIBDIR) cp src/lfs.so $(LUA_LIBDIR)
clean: clean:
rm -f src/lfs.so $(OBJS) rm -f src/lfs.so $(OBJS)

View File

@@ -1,13 +1,12 @@
[![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE) [![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENCE.txt)
[![Build Status](https://travis-ci.org/keplerproject/luafilesystem.svg?branch=master)](https://travis-ci.org/keplerproject/luafilesystem) [![Build Status](https://travis-ci.org/keplerproject/luafilesystem.svg?branch=master)](https://travis-ci.org/keplerproject/luafilesystem)
[![Build status](https://ci.appveyor.com/api/projects/status/y04s4ms7u16trw8e?svg=true)](https://ci.appveyor.com/project/ignacio/luafilesystem) [![Build status](https://ci.appveyor.com/api/projects/status/y04s4ms7u16trw8e?svg=true)](https://ci.appveyor.com/project/ignacio/luafilesystem)
[![Coverage Status](https://coveralls.io/repos/keplerproject/luafilesystem/badge.png)](https://coveralls.io/r/keplerproject/luafilesystem) [![Coverage Status](https://coveralls.io/repos/keplerproject/luafilesystem/badge.png)](https://coveralls.io/r/keplerproject/luafilesystem)
# LuaFileSystem - File System Library for Lua # LuaFileSystem - File System Library for Lua
Copyright 2003-2016 Kepler Project
Copyright 2003-2017 Kepler Project http://keplerproject.github.io/luafilesystem
https://keplerproject.github.io/luafilesystem
# Description # Description
@@ -15,7 +14,7 @@ LuaFileSystem is a Lua library developed to complement the set of functions
related to file systems offered by the standard Lua distribution. 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 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.x (MIT). LuaFileSystem is free software and uses the same license as Lua 5.1
# LuaRocks Installation # LuaRocks Installation

View File

@@ -1,179 +1,182 @@
body { body {
color: #47555c; margin-left: 1em;
font-size: 16px; margin-right: 1em;
font-family: "Open Sans", sans-serif; font-family: arial, helvetica, geneva, sans-serif;
margin: 0; background-color:#ffffff; margin:0px;
padding: 0;
background: #eff4ff;
}
a:link { color: #008fee; }
a:visited { color: #008fee; }
a:hover { color: #22a7ff; }
h1 { font-size:26px; }
h2 { font-size:24px; }
h3 { font-size:18px; }
h4 { font-size:16px; }
hr {
height: 1px;
background: #c1cce4;
border: 0px;
margin: 20px 0;
} }
code { code {
font-family: "Open Sans Mono", "Andale Mono", monospace; font-family: "Andale Mono", monospace;
} }
tt { tt {
font-family: "Open Sans Mono", "Andale Mono", monospace; font-family: "Andale Mono", monospace;
} }
body, td, th { body, td, th { font-size: 11pt; }
h1, h2, h3, h4 { margin-left: 0em; }
textarea, pre, tt { font-size:10pt; }
body, td, th { color:#000000; }
small { font-size:0.85em; }
h1 { font-size:1.5em; }
h2 { font-size:1.25em; }
h3 { font-size:1.15em; }
h4 { font-size:1.06em; }
a:link { font-weight:bold; color: #004080; text-decoration: none; }
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
a:link:hover { text-decoration:underline; }
hr { color:#cccccc }
img { border-width: 0px; }
h3 { padding-top: 1em; }
p { margin-left: 1em; }
p.name {
font-family: "Andale Mono", monospace;
padding-top: 1em;
margin-left: 0em;
} }
textarea, pre, tt { blockquote { margin-left: 3em; }
font-family: "Open Sans Mono", "Andale Mono", monospace;
}
img {
border-width: 0px;
}
.example { .example {
background-color: #323744; background-color: rgb(245, 245, 245);
color: white; border-top-width: 1px;
font-size: 16px; border-right-width: 1px;
padding: 16px 24px; border-bottom-width: 1px;
border-radius: 2px; border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: silver;
border-right-color: silver;
border-bottom-color: silver;
border-left-color: silver;
padding: 1em;
margin-left: 1em;
margin-right: 1em;
font-family: "Andale Mono", monospace;
font-size: smaller;
} }
div.header, div.footer { hr {
margin-left: 0em;
background: #00007f;
border: 0px;
height: 1px;
} }
#container { ul { list-style-type: disc; }
}
#product { table.index { border: 1px #00007f; }
background-color: white; table.index td { text-align: left; vertical-align: top; }
padding: 10px; table.index ul { padding-top: 0em; margin-top: 0em; }
height: 130px;
border-bottom: solid #d3dbec 1px;
}
#product big { table {
font-size: 42px; border: 1px solid black;
} border-collapse: collapse;
#product strong {
font-weight: normal;
}
#product_logo {
float: right;
}
#product_name {
padding-top: 15px;
padding-left: 30px;
font-size: 42px;
font-weight: normal;
}
#product_description {
padding-left: 30px;
color: #757779;
}
#main {
background: #eff4ff;
margin: 0;
}
#navigation {
width: 100%;
background-color: rgb(44,62,103);
padding: 10px;
margin: 0;
}
#navigation h1 {
display: none;
}
#navigation a:hover {
text-decoration: underline;
}
#navigation ul li a {
color: rgb(136, 208, 255);
font-weight: bold;
text-decoration: none;
}
#navigation ul li li a {
color: rgb(136, 208, 255);
font-weight: normal;
text-decoration: none;
}
#navigation ul {
display: inline;
color: white;
padding: 0px;
padding-top: 10px;
padding-bottom: 10px;
}
#navigation li {
display: inline;
list-style-type: none;
padding-left: 5px;
padding-right: 5px;
}
#navigation li {
padding: 10px;
padding: 10px;
}
#navigation li li {
}
#navigation li:hover a {
color: rgb(166, 238, 255);
}
#content {
padding: 20px;
width: 800px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
th {
border: 1px solid black;
padding: 0.5em;
}
td {
border: 1px solid black;
padding: 0.5em;
}
div.header, div.footer { margin-left: 0em; }
#container {
margin-left: 1em;
margin-right: 1em;
background-color: #f0f0f0;
}
#product {
text-align: center;
border-bottom: 1px solid #cccccc;
background-color: #ffffff;
}
#product big {
font-size: 2em;
}
#product_logo {
}
#product_name {
}
#product_description {
}
#main {
background-color: #f0f0f0;
border-left: 2px solid #cccccc;
}
#navigation {
float: left;
width: 12em;
margin: 0;
vertical-align: top;
background-color: #f0f0f0;
overflow:visible;
}
#navigation h1 {
background-color:#e7e7e7;
font-size:1.1em;
color:#000000;
text-align:left;
margin:0px;
padding:0.2em;
border-top:1px solid #dddddd;
border-bottom:1px solid #dddddd;
}
#navigation ul {
font-size:1em;
list-style-type: none;
padding: 0;
margin: 1px;
}
#navigation li {
text-indent: -1em;
margin: 0em 0em 0em 0.5em;
display: block;
padding: 3px 0px 0px 12px;
}
#navigation li li a {
padding: 0px 3px 0px -1em;
}
#content {
margin-left: 12em;
padding: 1em;
border-left: 2px solid #cccccc;
border-right: 2px solid #cccccc;
background-color: #ffffff;
}
#about { #about {
display: none; clear: both;
} margin: 0;
dl.reference {
background-color: white;
padding: 20px;
border: solid #d3dbec 1px;
}
dl.reference dt {
padding: 5px; padding: 5px;
padding-top: 25px; border-top: 2px solid #cccccc;
color: #637bbc; background-color: #ffffff;
}
dl.reference dl dt {
padding-top: 5px;
color: #637383;
}
dl.reference dd {
} }
@media print { @media print {

View File

@@ -70,30 +70,17 @@ 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.6.3. It works with Lua 5.1, 5.2 and 5.3.</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>
<p>LuaFileSystem can be installed using <a href="https://luarocks.org">LuaRocks</a>: <p>LuaFileSystem source can be downloaded from its
<a href="http://github.com/keplerproject/luafilesystem">Github</a>
<pre class="example"> page.</p>
$ luarocks install luafilesystem
</pre>
<p>Its source can be found at its <a href="http://github.com/keplerproject/luafilesystem">Github</a> page.</p>
<h2><a name="history"></a>History</h2> <h2><a name="history"></a>History</h2>
<dl class="history"> <dl class="history">
<dt><strong>Version 1.7.0</strong> [15/Sep/2017]</dt>
<dd><ul>
<li>symlinkattributes function now provides 'target' field, containing name of the file that the symlink points to.</li>
<li>attributes, symlinkattributes, touch, mkdir, and rmdir functions now return system-dependent error code as the third value on error.</li>
<li>Fixed detection of closed files for Lua 5.2+ in setmode, lock, and unlock functions.</li>
<li>Fixed various compiler warnings.</li>
</ul></dd>
<dt><strong>Version 1.6.3</strong> [15/Jan/2015]</dt> <dt><strong>Version 1.6.3</strong> [15/Jan/2015]</dt>
<dd><ul> <dd><ul>
<li>Lua 5.3 support.</li> <li>Lua 5.3 support.</li>

View File

@@ -84,7 +84,7 @@ Ierusalimschy, Andr&eacute; Carregal and Tom&aacute;s Guisasola.
The implementation is not derived from licensed software.</p> The implementation is not derived from licensed software.</p>
<hr/> <hr/>
<p>Copyright &copy; 2003 - 2017 Kepler Project.</p> <p>Copyright &copy; 2003 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

View File

@@ -1,28 +0,0 @@
package = "LuaFileSystem"
version = "1.7.0-1"
source = {
url = "git://github.com/keplerproject/luafilesystem",
tag = "v1_7_0",
}
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"
}
}

View File

@@ -1,28 +0,0 @@
package = "LuaFileSystem"
version = "1.7.0-2"
source = {
url = "git://github.com/keplerproject/luafilesystem",
tag = "v1_7_0_2",
}
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"
}
}

View File

@@ -1,6 +1,6 @@
/* /*
** LuaFileSystem ** LuaFileSystem
** Copyright Kepler Project 2003 - 2017 (http://keplerproject.github.io/luafilesystem) ** Copyright Kepler Project 2003 - 2016 (http://keplerproject.github.io/luafilesystem)
** **
** File system manipulation library. ** File system manipulation library.
** This library offers these functions: ** This library offers these functions:
@@ -69,7 +69,7 @@
#include "lfs.h" #include "lfs.h"
#define LFS_VERSION "1.7.0" #define LFS_VERSION "1.6.3"
#define LFS_LIBNAME "lfs" #define LFS_LIBNAME "lfs"
#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */ #if LUA_VERSION_NUM >= 503 /* Lua 5.3 */
@@ -80,10 +80,8 @@
#endif #endif
#if LUA_VERSION_NUM >= 502 #if LUA_VERSION_NUM < 502
# define new_lib(L, l) (luaL_newlib(L, l)) # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l))
#else
# define new_lib(L, l) (lua_newtable(L), luaL_register(L, NULL, l))
#endif #endif
/* Define 'strerror' for systems that do not implement it */ /* Define 'strerror' for systems that do not implement it */
@@ -186,12 +184,9 @@ static int get_dir (lua_State *L) {
size_t size = LFS_MAXPATHLEN; /* initial buffer size */ size_t size = LFS_MAXPATHLEN; /* initial buffer size */
int result; int result;
while (1) { while (1) {
char* path2 = realloc(path, size); path = realloc(path, size);
if (!path2) /* failed to allocate */ { if (!path) /* failed to allocate */
result = pusherror(L, "get_dir realloc() failed"); return pusherror(L, "get_dir realloc() failed");
break;
}
path = path2;
if (getcwd(path, size) != NULL) { if (getcwd(path, size) != NULL) {
/* success, push the path to the Lua stack */ /* success, push the path to the Lua stack */
lua_pushstring(L, path); lua_pushstring(L, path);
@@ -863,12 +858,9 @@ static int push_link_target(lua_State *L) {
char *target = NULL; char *target = NULL;
int tsize, size = 256; /* size = initial buffer capacity */ int tsize, size = 256; /* size = initial buffer capacity */
while (1) { while (1) {
char* target2 = realloc(target, size); target = realloc(target, size);
if (!target2) { /* failed to allocate */ if (!target) /* failed to allocate */
free(target);
return 0; return 0;
}
target = target2;
tsize = readlink(file, target, size); tsize = readlink(file, target, size);
if (tsize < 0) { /* a readlink() error occurred */ if (tsize < 0) { /* a readlink() error occurred */
free(target); free(target);
@@ -910,7 +902,7 @@ static int link_info (lua_State *L) {
** Assumes the table is on top of the stack. ** Assumes the table is on top of the stack.
*/ */
static void set_info (lua_State *L) { static void set_info (lua_State *L) {
lua_pushliteral(L, "Copyright (C) 2003-2017 Kepler Project"); lua_pushliteral(L, "Copyright (C) 2003-2016 Kepler Project");
lua_setfield(L, -2, "_COPYRIGHT"); lua_setfield(L, -2, "_COPYRIGHT");
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_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_setfield(L, -2, "_DESCRIPTION"); lua_setfield(L, -2, "_DESCRIPTION");
@@ -939,7 +931,7 @@ static const struct luaL_Reg fslib[] = {
LFS_EXPORT int luaopen_lfs (lua_State *L) { LFS_EXPORT int luaopen_lfs (lua_State *L) {
dir_create_meta (L); dir_create_meta (L);
lock_create_meta (L); lock_create_meta (L);
new_lib (L, fslib); luaL_newlib (L, fslib);
lua_pushvalue(L, -1); lua_pushvalue(L, -1);
lua_setglobal(L, LFS_LIBNAME); lua_setglobal(L, LFS_LIBNAME);
set_info (L); set_info (L);

View File

@@ -1,4 +1,4 @@
LIBRARY lfs.dll LIBRARY lfs.dll
VERSION 1.7 VERSION 1.6
EXPORTS EXPORTS
luaopen_lfs luaopen_lfs

View File

@@ -1,6 +1,6 @@
/* /*
** LuaFileSystem ** LuaFileSystem
** Copyright Kepler Project 2003 - 2017 (http://keplerproject.github.io/luafilesystem) ** Copyright Kepler Project 2003 - 2016 (http://keplerproject.github.io/luafilesystem)
*/ */
/* Define 'chdir' for systems that do not implement it */ /* Define 'chdir' for systems that do not implement it */