lua-users home
lua-l archive

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

2003-03-18T13:31:21 Peter Hill:
> Peter Hill:
> > By the way, writing a checkpatch function would be very OS specific.
> Which is a good reason to wrap it all in one function rather than spread
> it through several.

And a utility helper library can ease expressing pathname
manipulations in a portable fashion; one stab at this can be seen in
the API of perl's File::Basename module:

	(name, path, suffix) = fileparse(pathname, suffixlist)

where suffixlist is an array of suffixes (including their leading
dots or whatever) that you'd like to see separated, and pathname is
the full text pathname. name gets filled in with the base filename
without the suffix, path is the prefix telling where the file can be
found, and suffix is of course the suffix that was found and removed
to create name (if any).

There's another routine filepart_set_fstype to set the filename
grammer fileparse should use, and some simpler routines providing
the commoner dirname() and basename() special-cases.

Dunno whether such a helper library would be harmonious with
tasteful Lua design or not, I'm not a Lua guru, but perhaps at least
the abstract concept might be helpful to consider.


Attachment: pgptBmk3pXk5N.pgp
Description: PGP signature