diff options
Diffstat (limited to 'src/lfs.c')
| -rw-r--r-- | src/lfs.c | 14 |
1 files changed, 8 insertions, 6 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** LuaFileSystem | 2 | ** LuaFileSystem |
| 3 | ** Copyright Kepler Project 2004-2007 (http://www.keplerproject.org/luafilesystem) | 3 | ** Copyright Kepler Project 2003 (http://www.keplerproject.org/luafilesystem) |
| 4 | ** | 4 | ** |
| 5 | ** File system manipulation library. | 5 | ** File system manipulation library. |
| 6 | ** This library offers these functions: | 6 | ** This library offers these functions: |
| @@ -11,11 +11,12 @@ | |||
| 11 | ** lfs.lock (fh, mode) | 11 | ** lfs.lock (fh, mode) |
| 12 | ** lfs.mkdir (path) | 12 | ** lfs.mkdir (path) |
| 13 | ** lfs.rmdir (path) | 13 | ** lfs.rmdir (path) |
| 14 | ** lfs.setmode (filepath, mode) | ||
| 14 | ** lfs.symlinkattributes (filepath [, attributename]) -- thanks to Sam Roberts | 15 | ** lfs.symlinkattributes (filepath [, attributename]) -- thanks to Sam Roberts |
| 15 | ** lfs.touch (filepath [, atime [, mtime]]) | 16 | ** lfs.touch (filepath [, atime [, mtime]]) |
| 16 | ** lfs.unlock (fh) | 17 | ** lfs.unlock (fh) |
| 17 | ** | 18 | ** |
| 18 | ** $Id: lfs.c,v 1.46 2008/01/25 17:09:56 mascarenhas Exp $ | 19 | ** $Id: lfs.c,v 1.47 2008/02/11 22:42:21 carregal Exp $ |
| 19 | */ | 20 | */ |
| 20 | 21 | ||
| 21 | #include <errno.h> | 22 | #include <errno.h> |
| @@ -75,7 +76,7 @@ typedef struct dir_data { | |||
| 75 | #define _O_TEXT 0 | 76 | #define _O_TEXT 0 |
| 76 | #define _O_BINARY 0 | 77 | #define _O_BINARY 0 |
| 77 | #define lfs_setmode(L,file,m) ((void)((void)file,m), \ | 78 | #define lfs_setmode(L,file,m) ((void)((void)file,m), \ |
| 78 | luaL_error(L, LUA_QL("setmode") " not supported"), -1) | 79 | luaL_error(L, LUA_QL("setmode") " not supported on non Windows platforms"), -1) |
| 79 | #endif | 80 | #endif |
| 80 | 81 | ||
| 81 | /* | 82 | /* |
| @@ -619,13 +620,13 @@ static int link_info (lua_State *L) { | |||
| 619 | */ | 620 | */ |
| 620 | static void set_info (lua_State *L) { | 621 | static void set_info (lua_State *L) { |
| 621 | lua_pushliteral (L, "_COPYRIGHT"); | 622 | lua_pushliteral (L, "_COPYRIGHT"); |
| 622 | lua_pushliteral (L, "Copyright (C) 2003-2007 Kepler Project"); | 623 | lua_pushliteral (L, "Copyright (C) 2003 Kepler Project"); |
| 623 | lua_settable (L, -3); | 624 | lua_settable (L, -3); |
| 624 | lua_pushliteral (L, "_DESCRIPTION"); | 625 | lua_pushliteral (L, "_DESCRIPTION"); |
| 625 | 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"); | 626 | 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"); |
| 626 | lua_settable (L, -3); | 627 | lua_settable (L, -3); |
| 627 | lua_pushliteral (L, "_VERSION"); | 628 | lua_pushliteral (L, "_VERSION"); |
| 628 | lua_pushliteral (L, "LuaFileSystem 1.3.0"); | 629 | lua_pushliteral (L, "LuaFileSystem 1.4.0"); |
| 629 | lua_settable (L, -3); | 630 | lua_settable (L, -3); |
| 630 | } | 631 | } |
| 631 | 632 | ||
| @@ -636,11 +637,12 @@ static const struct luaL_reg fslib[] = { | |||
| 636 | {"currentdir", get_dir}, | 637 | {"currentdir", get_dir}, |
| 637 | {"dir", dir_iter_factory}, | 638 | {"dir", dir_iter_factory}, |
| 638 | {"lock", file_lock}, | 639 | {"lock", file_lock}, |
| 639 | {"setmode", lfs_f_setmode}, | ||
| 640 | {"mkdir", make_dir}, | 640 | {"mkdir", make_dir}, |
| 641 | {"rmdir", remove_dir}, | 641 | {"rmdir", remove_dir}, |
| 642 | #ifndef _WIN32 | 642 | #ifndef _WIN32 |
| 643 | {"symlinkattributes", link_info}, | 643 | {"symlinkattributes", link_info}, |
| 644 | #else | ||
| 645 | {"setmode", lfs_f_setmode}, | ||
| 644 | #endif | 646 | #endif |
| 645 | {"touch", file_utime}, | 647 | {"touch", file_utime}, |
| 646 | {"unlock", file_unlock}, | 648 | {"unlock", file_unlock}, |
