lua-users home
lua-l archive

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

Hi list, I'm very happy to release the 0.3 version of lpath[1] library.


To install, just use luarocks:
   luarocks install lpath

lpath is a lfs-like Lua module to handle path, file system and file

This module is designed to be easy extend to new system. Now it
implements windows using Win32 API (lfs use legacy POSIX APIs on
Windows), and POSIX systems.

This module is inspired by Python's `os.path` and `pathlib` module. It
split into 4 parts:

- `path`: main module, pathlib style path operations.
- `path.fs`: fs specific operations, folder walking, file operations, etc.
- ``: some constants about path literals.
- `path.env` set/get environment variables, and expand env vars in path.

For the 0.3 version, lpath has been rewritten completely. main changes:
- Previous release have two different implementation for `fs.dir()`
and `fs.scandir()`, that makes folder iteration has to implement four
times (2 for windows, and 2 for POSIX), now with the new walker
interface introduced, the implement has been simplified a lot.
- A new `path.match()` implements Python's path aware match algorithm,
with checks each parts of path with pattern, including drive, root and
dots, etc.
- A new `fs.glob()` implements combine new walker interface and match
algorithm, will walk into folders according to the current part match
results. and support `**` match, just like Python's
- A new `lp_PartResult` and `lp_joinparts()` routine in C code largely
simplify the implement of most of routines.
- All `path.split*` routines are removed, instead of the new routines
from pathlib: ``, `path.root`, `path.anchor`, ``,
`path.parent`, ``, `path.stem`, `path.shuffix` and
`path.shuffixes`. All with test-cases copies from Python.
- New `path.isdir()`, `path.islink()`, `path.isfile()`,
`path.ismount()` routines for platform cross file attribute checks,
compatible with Python.
- New implementations has 95% code coverage.

All feedbacks are welcome.

Xavier Wang.