lua-users home
lua-l archive

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


On Wed, Jul 7, 2010 at 7:09 AM, David Manura <dm.lua@math2.org> wrote:
> Penlight implements such a "path manipulation" module [1,2].

Note that the new canonical documentation URL is:

http://stevedonovan.github.com/Penlight/api/modules/pl.path.html

This is basically a translation of Python's os.path; not that I felt
that this was obviously a superior API, simply a de facto standard
that has been around the block a few times and has proved useful to a
lot of people.  However, it's part of a framework and so dependent on
other bits of Penlight (particularly pl.utils)  So there's still a
need for a stand-alone library.

A design principle for path manipulation libraries is that one should
provide a minimal 'spanning set' of functions which can handle all the
common cases with as few functions as possible.

pl.dir provides a walk() function for traversing directory trees, also
Python-inspired; I mention this because I can never remember the
subtleties of the Unix 'find' command and it is more natural for a Lua
program to use a flexible globbing file iterator.

Plus, cross-platform does matter, although I suppose system management
scripts are unlikely to need to stretch across both Windows and POSIX.

steve d.