mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-24 20:33:06 +00:00
Merge branch 'master' into 1.7
This commit is contained in:
@@ -875,7 +875,7 @@ static const struct luaL_Reg fslib[] = {
|
|||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
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);
|
||||||
luaL_newlib (L, fslib);
|
luaL_newlib (L, fslib);
|
||||||
|
|||||||
@@ -9,23 +9,25 @@
|
|||||||
#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)
|
||||||
#ifndef fileno
|
#ifndef fileno
|
||||||
#define fileno(f) (_fileno(f))
|
#define fileno(f) (_fileno(f))
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#define LFS_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int luaopen_lfs (lua_State *L);
|
LFS_EXPORT int luaopen_lfs (lua_State *L);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ assert(result) -- on non-Windows platforms, mode is always returned as "binary"
|
|||||||
result, mode = lfs.setmode(f, "text")
|
result, mode = lfs.setmode(f, "text")
|
||||||
assert(result and mode == "binary")
|
assert(result and mode == "binary")
|
||||||
f:close()
|
f:close()
|
||||||
|
local ok, err = pcall(lfs.setmode, f, "binary")
|
||||||
|
assert(not ok, "could setmode on closed file")
|
||||||
|
assert(err:find("closed file"), "bad error message for setmode on closed file")
|
||||||
|
|
||||||
io.write(".")
|
io.write(".")
|
||||||
io.flush()
|
io.flush()
|
||||||
|
|||||||
Reference in New Issue
Block a user