diff --git a/doc/us/manual.html b/doc/us/manual.html index 217c249..a5843ed 100644 --- a/doc/us/manual.html +++ b/doc/us/manual.html @@ -228,8 +228,8 @@ LuaFileSystem offers the following functions:
lfs.symlinkattributes (filepath [, aname])
Identical to lfs.attributes except that it obtains information about the link itself (not the file it refers to). - This function is not available in Windows so you may want to make sure that - lfs.symlinkattributes exists before using it. + On Windows this function does not yet support links, and is identical to + lfs.attributes.
lfs.touch (filepath [, atime [, mtime]])
diff --git a/src/lfs.c b/src/lfs.c index 8e94d4f..63d2dbd 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -96,6 +96,7 @@ typedef struct dir_data { #define STAT_STRUCT struct _stati64 #endif #define STAT_FUNC _stati64 +#define LSTAT_FUNC STAT_FUNC #else #define _O_TEXT 0 #define _O_BINARY 0 @@ -743,17 +744,9 @@ static int file_info (lua_State *L) { /* ** Get symbolic link information using lstat. */ -#ifndef _WIN32 static int link_info (lua_State *L) { return _file_info_ (L, LSTAT_FUNC); } -#else -static int link_info (lua_State *L) { - lua_pushboolean(L, 0); - lua_pushliteral(L, "symlinkattributes not supported on this platform"); - return 2; -} -#endif /* diff --git a/tests/test.lua b/tests/test.lua index 7111074..6af7e9b 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -69,13 +69,11 @@ local new_att = assert (lfs.attributes (tmpfile)) assert (new_att.access == testdate2, "could not set access time") assert (new_att.modification == testdate1, "could not set modification time") -local res, err = lfs.symlinkattributes(tmpfile) -if err ~= "symlinkattributes not supported on this platform" then - -- Checking symbolic link information (does not work in Windows) - assert (os.execute ("ln -s "..tmpfile.." _a_link_for_test_")) - assert (lfs.attributes"_a_link_for_test_".mode == "file") - assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link") - assert (os.remove"_a_link_for_test_") +-- Checking symbolic link information (does not work in Windows) +if (os.execute ("ln -s "..tmpfile.." _a_link_for_test_")) then + assert (lfs.attributes"_a_link_for_test_".mode == "file") + assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link") + assert (os.remove"_a_link_for_test_") end if lfs.setmode then