mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-24 20:33:06 +00:00
Correcoes em valores de retorno de funcoes.
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
** lfs.lock (fh, mode)
|
** lfs.lock (fh, mode)
|
||||||
** lfs.unlock (fh)
|
** lfs.unlock (fh)
|
||||||
**
|
**
|
||||||
** $Id: lfs.c,v 1.11 2004/11/05 10:37:29 tomas Exp $
|
** $Id: lfs.c,v 1.12 2004/11/05 10:54:28 tomas Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -239,8 +239,10 @@ static int make_dir (lua_State *L) {
|
|||||||
S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH );
|
S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH );
|
||||||
#endif
|
#endif
|
||||||
lua_pushboolean (L, !fail);
|
lua_pushboolean (L, !fail);
|
||||||
if (fail)
|
if (fail) {
|
||||||
lua_pushfstring (L, "%s", strerror(errno));
|
lua_pushfstring (L, "%s", strerror(errno));
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
umask (oldmask);
|
umask (oldmask);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ local reldir = string.gsub (current, "^.*%"..sep.."([^"..sep.."])$", "%1")
|
|||||||
assert (lfs.chdir (upper), "could not change to upper directory")
|
assert (lfs.chdir (upper), "could not change to upper directory")
|
||||||
assert (lfs.chdir (reldir), "could not change back to current directory")
|
assert (lfs.chdir (reldir), "could not change back to current directory")
|
||||||
assert (lfs.currentdir() == current, "error trying to change directories")
|
assert (lfs.currentdir() == current, "error trying to change directories")
|
||||||
assert (lfs.chdir ("this couldn't be an actual directory") == false, "could change to a non-existent directory")
|
assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory")
|
||||||
-- Changing creating and removing directories
|
-- Changing creating and removing directories
|
||||||
assert (lfs.mkdir (tmp.."/lfs_tmp_dir"), "could not make a new directory")
|
assert (lfs.mkdir (tmp.."/lfs_tmp_dir"), "could not make a new directory")
|
||||||
assert (os.remove (tmp.."/lfs_tmp_dir"), "could not remove new directory")
|
assert (os.remove (tmp.."/lfs_tmp_dir"), "could not remove new directory")
|
||||||
assert (lfs.mkdir (tmp.."/lfs_tmp_dir/lfs_tmp_dir") == false, "could create a directory inside a non-existent one")
|
assert (lfs.mkdir (tmp.."/lfs_tmp_dir/lfs_tmp_dir") == false, "could create a directory inside a non-existent one")
|
||||||
--
|
--
|
||||||
assert (lfs.attributes ("this couldn't be an actual file") == false, "could get attributes of a non-existent file")
|
assert (lfs.attributes ("this couldn't be an actual file") == nil, "could get attributes of a non-existent file")
|
||||||
assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory")
|
assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory")
|
||||||
|
|||||||
Reference in New Issue
Block a user