Rust-native port of the LuaFileSystem (lfs) module — Phase G-1.
Provides the 8 lfs functions LuaRocks actually uses:
| function | std::fs / std::env equivalent |
|---|---|
lfs.attributes(path [, req]) |
std::fs::metadata(path) |
lfs.dir(path) |
std::fs::read_dir(path) |
lfs.mkdir(path) |
std::fs::create_dir(path) |
lfs.rmdir(path) |
std::fs::remove_dir(path) |
lfs.chdir(path) |
std::env::set_current_dir(path) |
lfs.currentdir() |
std::env::current_dir() |
lfs.touch(path [,a [,m]]) |
filetime::set_file_times |
lfs.link(old, new [, sym]) |
std::fs::hard_link / symlink |
Out of scope (LuaRocks does not exercise these): lfs.lock, lfs.unlock,
lfs.symlinkattributes, lfs.setmode.
Registration: the entry point [luaopen_lfs] builds and returns the lfs
table. lua-cli installs that function in package.preload.lfs after
open_libs and before user code runs, so require('lfs') resolves via
the preload searcher and the rest of the lfs API ends up where stock lfs
users expect to find it.