lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Jul 6, 2010 at 6:19 PM, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Tue, Jul 6, 2010 at 21:10, Hisham <hisham.hm@gmail.com> wrote:
>> ... (the LuaRocks modules try to use stuff such as LuaFileSystem when
>> available or command-line tools as a fallback).
> On Tue, Jul 6, 2010 at 8:52 PM, Hisham <hisham.hm@gmail.com> wrote:
>> Using lfs directly in scripts can be a
>> bit too low-level at times (for example, luarocks.fs offers functions
>> such as fs.copy, fs.move and fs.recursive_delete). LuaRocks also
>> offers a pure-Lua module called luarocks.dir with things such
>> dir.dir_name and dir.base_name, which also save a few forks.
>...
> I think that it should be not a single module, but a family of modules.
>
> At least these three:
>
> -- String: expansion, escaping
> -- Path manipulation

Penlight implements such a "path manipulation" module [1,2].  To
refine this, see established libraries like boost::filesystem [3] and
those by major scripting languages.

[1] http://penlight.luaforge.net/#T17
[2] http://penlight.luaforge.net/api/modules/pl.path.html
[3] http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/index.htm

> -- Process execution, output redirection and piping.

And the fourth noted by Hisham is

  -- filesystem I/O abstraction (e.g. fs.recursive_delete)

which I think should be a separate module from the core shell
abstraction module (for quoting/exec).  The filesystem I/O abstraction
module would have optional dependencies on other modules like the
shell abstraction module, LuaFileSystem, and lposix.