aboutsummaryrefslogtreecommitdiff
path: root/src/lfs.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into 2.02.0Hisham2016-10-191-44/+97
|\
| * Dynamically size getcwd() buffer in get_dir function (#84)NiteHawk2016-10-141-41/+46
| | | | | | | | | | | | | | | | | | | | * Dynamically size getcwd() buffer in get_dir function This should fix issue 42. * Fixup: Properly respect NO_GETCWD * Fixup: Get rid of getcwd_error, handle NO_GETCWD in a single place
| * Fix lfs.attributes and lfs.symlinkattributes extra argument handlingPeter Melnichenko2016-08-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | When the second argument is not a string, _file_info() wants to ensure that there is a table on top of the stack: the second argument or a new table. If a new table is pushed it's created on top immediately, but if a table is passed as the second argument it can be followed by extra arguments, with the last one ending up being used as a table, causing a crash. The fix is to remove any potential extra arguments using `lua_settop(L, 2)`. Also added a few tests for this case. Ref #80.
| * Add a 'target' field for symlinkattributes.NiteHawk2016-07-161-1/+48
| | | | | | | | | | | | | | It returns the resolved path of the symlink. Original version by Hisham <hisham@gobolinux.org>, modified to use a different strategy for sizing the readlink() buffer.
| * Fix export of luaopen_lfs on Windows (#74)Eric Cosatto2016-06-011-1/+1
| | | | | | | | * Make lfs export luaopen_lfs under Windows
* | Don't declare global 'lfs'Peter Melnichenko2016-05-051-3/+0
| |
* | Return true instead of 0 on lfs.link successPeter Melnichenko2016-05-051-7/+1
| |
* | Return errno from lfs.attributes on errorPeter Melnichenko2016-05-051-1/+2
| |
* | Return errno from lfs.touch on errorPeter Melnichenko2016-05-051-18/+16
| |
* | Return errno from lfs.rmdir on errorPeter Melnichenko2016-05-051-12/+2
| |
* | Return errno from lfs.mkdir on errorPeter Melnichenko2016-05-051-29/+28
|/ | | | | Change pushresult() to return true on success. Change make_link to keep returning 0.
* Include strerror(errno) into error message in lfs.attributesPeter Melnichenko2016-05-051-2/+2
|
* Add attribute name to error on invalid attribute in lfs.attributesPeter Melnichenko2016-05-051-1/+1
|
* Document passing table as second argument to lfs.attributesPeter Melnichenko2016-05-041-1/+1
|
* Refactor set_info() using lua_setfieldPeter Melnichenko2016-05-041-9/+6
| | | | | | | About indentation: currently parts of lfs.c use 2 spaces and parts use 8. It would be nice to slowly switch to one of styles over some time, as code is being touched here and there. 2 spaces seem preferrable as it's what Lua itself uses.
* Update top level commentsPeter Melnichenko2016-05-041-4/+3
|
* Fix a warning when compiling as C++11Peter Melnichenko2016-05-041-1/+1
|
* Merge pull request #68 from mpeterv/setmode-refactorHisham Muhammad2016-04-251-11/+6
|\ | | | | Minor refactoring of setmode
| * Don't pass Lua state to lfs_setmode, it's always unusedPeter Melnichenko2016-04-251-4/+4
| |
| * Use pusherror in lfs_g_setmodePeter Melnichenko2016-04-251-5/+1
| |
| * Get rid of goto in lfs_g_setmodePeter Melnichenko2016-04-251-2/+1
| |
* | Have make_link() use pushresult() instead of pusherror() on WindowsNiteHawk2016-03-251-1/+2
|/ | | | | | | | | | The pushresult(L, -1, ...) call will delegate to pusherror() anyway, but this avoids the "Unused static" warning for pushresult. Also take care of assigning something meaningful to `errno`, as strerror(errno) is used for constructing the Lua error message. Fixes #65
* Fix detection of closed files on Lua 5.2/5.3.Philipp Janda2015-06-141-4/+12
| | | | | | | | | Lua 5.2 changed the protocol on how to represent closed files: Lua 5.1 sets the file pointer to NULL, Lua 5.2 sets the close function pointer to NULL (a NULL file pointer now signals an incompletely constructed object). Also `luaL_checkudata` never returns NULL, it raises an error instead if you have an invalid value (no userdata/not correct userdata type).
* Merge branch 'master' of git://github.com/keplerproject/luafilesystemHisham Muhammad2015-03-191-2/+2
|\
| * A few minor things fixed which prevented compilation of LuaFileSystem as C++ ↵Alex2015-02-151-2/+2
| | | | | | | | code
* | Prepare for release 1.6.3v_1_6_3v1_6_3Hisham Muhammad2015-01-151-1/+1
| |
* | Cleanup use of explicit \0Hisham Muhammad2015-01-151-2/+2
|/
* Updated to support Lua 5.3. Fixed to supress warnings in windows. Removed ↵Andrew Starks2015-01-151-18/+18
| | | | extra null byte off of const string (windows only).
* Merge pull request #46 from moteus/masterHisham Muhammad2014-11-121-0/+8
|\ | | | | Add. Travis files.
| * Fix. Support Lua 5.3.betaAlexey Melnichuk2014-11-121-0/+8
| |
* | Add LFS_DO_NOT_USE_LARGE_FILE flagMikhael-Danilov2014-09-251-0/+4
|/ | | Which disables LARGE_FILE support
* Fix. Compile with MSVC and with gcc without `-std=c99`Alexey Melnichuk2014-08-131-2/+6
|
* Fix lfs.attributes(file, 'blksize')Stefan Hoffmann2014-08-091-24/+15
| | | | | | | fs.attributes(file, 'blksize') and fs.attributes(file, 'blocks) return the wrong values. Compare the whole attribute name instead of the first char and remove buggy special casing with wrong indexes into the member array.
* Fix. Prevents double close the same handle (#24)Alexey Melnichuk2014-01-081-1/+4
| | | | | | | | lfs_unlock_dir can be called multiple times for the same object. For example if lock:free is called manually. Then lfs_unlock_dir will be called always again, as soon as the LOCK_METATABLE is collected by GC. This can lead to strange file errors later on, like closing another file, which now has been assigned the same handle...
* Fix. Use intptr_t to file handle on Windows (#26)Alexey Melnichuk2014-01-041-1/+1
| | | Tested on MS VS2008(x32) MinGW(x32) and MS VS2012(x64)
* Update src/lfs.cMikhael-Danilov2013-02-201-1/+1
| | | Fix Windows build: make_link now returns int as it should
* Merge pull request #19 from devurandom/fix/warningsFabio Mascarenhas2012-10-041-4/+6
|\ | | | | Fix some warnings GCC produced on Linux
| * Fix warnings: unused variableDennis Schridde2012-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | On non-win32 lfs_setmode was defined to 0, ignoring all parameters. Now the parameters are explicitly discarded. Fixes: src/lfs.c: In function ‘lfs_g_setmode’: src/lfs.c:324:7: warning: unused variable ‘op’ [-Wunused-variable] src/lfs.c:321:47: warning: unused parameter ‘f’ [-Wunused-parameter]
| * Fix warning: C++ style comments are not allowed in ISO C90Dennis Schridde2012-10-041-3/+5
| |
* | Set global "lfs" when opening moduleDennis Schridde2012-10-041-0/+3
| | | | | | | | | | * Ensures backward compatibility with LFS 1.5 * Module name is defined as LFS_LIBNAME, similar to how Lua standard libraries are defined
* | Bump version to 1.6.2 and set version via define in src/lfs.c to make it ↵Dennis Schridde2012-10-031-1/+3
| | | | | | | | better visible
* | Full Lua 5.2 compatibility and adherance to modules-create-no-globalsDennis Schridde2012-10-031-13/+7
|/
* lfs.c: use Lua 5.2's own luaL_registerReuben Thomas2012-10-011-9/+1
|
* luafilesystem 1.6.0Fabio Mascarenhas2012-10-011-330/+330
|
* Merge pull request #15 from ewmailing/masterFabio Mascarenhas2012-09-261-6/+10
|\ | | | | Improvements to use of getcwd() for using the correct max path length
| * Due to Android (and apparently Sun) not supporting getcwd(NULL, 0), I've ↵Eric Wing2012-05-011-6/+10
| | | | | | | | | | | | changed to call to getcwd to specify a buffer and explicit size which successfully works around the problem. One minor performance advantage is that one less malloc/free is needed since the buffer is now created on the stack. Apparently, this was already changed in a prior commit I didn't see initially, but I think the use of an invented/arbitrary PATH_MAX is incorrect. Platforms should generally provide a constant for this and PATH_MAX itself is already defined on some systems like Linux which can cause collisions. This commit improves on those changes by leveraging the constants provided by the compiler/system. To help keep the code consistent but still correct, new platform specific code needed to be introduced for the max length. On POSIX I am assuming it is that <sys/param.h> provides MAXPATHLEN. This is what the Mac/BSD man page says to use and verified this is also defined on Ubuntu Linux and Android. On Windows, MAX_PATH is used. MAX_PATH seems to still be 260 which seems kind of small; is there a different constant we are supposed to use? In both cases, the respective constants are mapped to a new #define for LFS_MAXPATHLEN to allow the code to refer to one constant and avoid any potential name collisions in case MAXPATHLEN is defined already by something else on Windows (e.g. Cygwin).
* | Merge pull request #14 from icgood/masterFabio Mascarenhas2012-08-311-0/+9
|\ \ | |/ |/| 5.2 compatibility
| * implements fake luaL_register in Lua 5.2+Ian Good2012-02-281-0/+9
| |
* | applied debian patches from enrico tassiFabio Mascarenhas2012-04-081-3/+57
|/
* Simplify and clarify metatable creation functions.Reuben Thomas2011-06-091-10/+12
|