mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-23 19:43:06 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1f0f80141 | ||
|
|
aa18f3e127 | ||
|
|
6d6fd631ba | ||
|
|
46bbddc5a2 |
11
src/lfs.c
11
src/lfs.c
@@ -70,7 +70,6 @@
|
|||||||
#include "lfs.h"
|
#include "lfs.h"
|
||||||
|
|
||||||
#define LFS_VERSION "1.6.3"
|
#define LFS_VERSION "1.6.3"
|
||||||
#define LFS_LIBNAME "lfs"
|
|
||||||
|
|
||||||
#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */
|
#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */
|
||||||
|
|
||||||
@@ -434,13 +433,7 @@ static int make_link (lua_State *L) {
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
const char *oldpath = luaL_checkstring(L, 1);
|
const char *oldpath = luaL_checkstring(L, 1);
|
||||||
const char *newpath = luaL_checkstring(L, 2);
|
const char *newpath = luaL_checkstring(L, 2);
|
||||||
int res = (lua_toboolean(L,3) ? symlink : link)(oldpath, newpath);
|
return pushresult(L, (lua_toboolean(L, 3) ? symlink : link)(oldpath, newpath), NULL);
|
||||||
if (res == -1) {
|
|
||||||
return pusherror(L, NULL);
|
|
||||||
} else {
|
|
||||||
lua_pushinteger(L, 0);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
errno = ENOSYS; /* = "Function not implemented" */
|
errno = ENOSYS; /* = "Function not implemented" */
|
||||||
return pushresult(L, -1, "make_link is not supported on Windows");
|
return pushresult(L, -1, "make_link is not supported on Windows");
|
||||||
@@ -932,8 +925,6 @@ 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);
|
||||||
lua_pushvalue(L, -1);
|
|
||||||
lua_setglobal(L, LFS_LIBNAME);
|
|
||||||
set_info (L);
|
set_info (L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ io.write(".")
|
|||||||
io.flush()
|
io.flush()
|
||||||
|
|
||||||
-- Checking link (does not work on Windows)
|
-- Checking link (does not work on Windows)
|
||||||
if lfs.link (tmpfile, "_a_link_for_test_", true) then
|
local link_ok = lfs.link (tmpfile, "_a_link_for_test_", true)
|
||||||
|
if link_ok then
|
||||||
|
assert (link_ok == true, "successful lfs.link did not return true")
|
||||||
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
||||||
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
||||||
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
|
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user