A recent change to an example on the Wireshark Wiki had code to make a
directory; it does it using os.execute with a mkdir command. It's portable,
but doing system(blah blah blah) (or its Windows equivalent) has always struck
me as a bit of a hack (and potentially fragile, e.g. with string quoting
issues).
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?
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().
It also matches what we do in C/C++ code in Wireshark.
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <[email protected]>
Archives: http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]?subject=unsubscribe