Wireshark-dev: Re: [Wireshark-dev] Add-on Lua code for file system operations?
From: Hadriel Kaplan <hadriel.kaplan@xxxxxxxxxx>
Date: Fri, 7 Feb 2014 22:31:50 -0500
On Feb 7, 2014, at 8:04 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

> There's a LuaFileSystem package:
> 
> 	http://keplerproject.github.io/luafilesystem/
> 
> that presumably uses standard UN*X calls on UN*Xes and appropriate Windows calls on Windows.
> 
> We also have our own wrappers in the wsutil library for some file system operations.
> 
> Should we either bundle the LuaFileSystem stuff, at least on platforms where we bundle Lua with Wireshark rather than relying on the OS to have it as a package (I guess the packager could make the appropriate Wireshark package depend on the LuaFileSystem package, if one exists), or do our own Lua extensions using the wsutil routines?

LFS is kinda heavy for our needs I think.  Fwiw, there’s already a wslua 'Dir' class available via wslua_util.c, though it only provides directory filename iteration.  It just maps to glib’s GDir.


> The latter may handle non-ASCII pathnames better on Windows - a quick look at the LuaFileSystem seems not to indicate that it does any UTF-8-to-UTF-16 mapping, it just calls _mkdir(), but we map UTF-8 to UTF-16 and call _wmkdir().  

In fairness to LFS, Lua itself doesn’t really handle unicode very well.


> It also matches what we do in C/C++ code in Wireshark.

Yeah, that’s probably the safest route.

-hadriel