FS#11347 - *dir LUA functions
Opened by Rafaël Carré (funman) - Thursday, 03 June 2010, 00:37 GMT
Last edited by Rafaël Carré (funman) - Friday, 18 June 2010, 13:11 GMT
LUA doesn't implement any directory functions because those aren't in ANSI C
There is an implementation on http://www.keplerproject.org/luafilesystem with :
attributes (filepath [, attributename]) (stat())
currentdir () (getcwd)
dir (path) (readdir() iterator)
lock (fh, mode) ?
lfs.lock_dir (path) ?
setmode (filepath, mode) (TEXT/BINARY)
symlinkattributes (filepath [, attributename]) (lstat())
touch (filepath [, atime [, mtime]])
unlock (fh) ?
I only took the code for mkdir/rmdir and the directory iterator
The iterator returns 2 arguments: string (path) and bool (is directory), while the original code only returned a string relied on attributes/stat() to know if it was a directory.
It's a new "luadir" module although I think it could be in rocklib
Tested in sim and target (fuzev1)
Friday, 18 June 2010, 13:11 GMT
Reason for closing: Accepted
Additional comments about closing: r26913
correct suggested return value mapping: 0 -> true, non 0 -> false