fs: add shell-based fallback tier when lfs is unavailable #3

Open
opened 2026-03-16 19:09:39 +01:00 by michael · 1 comment
Owner

Currently fs.lua hard-exits if luafilesystem (lfs) is not installed.

Add a shell-based fallback tier so fs.lua works without lfs,
similar to the json.lua (3-tier) and yaml.lua (2-tier) approach.

Proposed tiers

  1. lfs (C, full featured) -- current implementation
  2. shell fallback (io.popen + mkdir/cp/mv/rm) -- new

Scope

Shell fallback only needs to cover the basic operations:

  • exists, is_dir via shell test
  • mkdir_p via mkdir -p
  • list_dirs via ls
  • read_file / write_file via io.open (already pure Lua)
  • copy / remove / rename via cp / mv / rm

read_attrs() can return a minimal subset or nil in shell tier.

Out of scope

Windows compatibility -- DAW targets OpenBSD, Debian, Arch only.

Notes

Low priority -- lfs is available on all supported platforms as a
package. This is a rainy-day quality-of-life improvement.

Refs: DAW/daw-lua-common#2

Currently fs.lua hard-exits if luafilesystem (lfs) is not installed. Add a shell-based fallback tier so fs.lua works without lfs, similar to the json.lua (3-tier) and yaml.lua (2-tier) approach. ## Proposed tiers 1. lfs (C, full featured) -- current implementation 2. shell fallback (io.popen + mkdir/cp/mv/rm) -- new ## Scope Shell fallback only needs to cover the basic operations: - exists, is_dir via shell test - mkdir_p via mkdir -p - list_dirs via ls - read_file / write_file via io.open (already pure Lua) - copy / remove / rename via cp / mv / rm read_attrs() can return a minimal subset or nil in shell tier. ## Out of scope Windows compatibility -- DAW targets OpenBSD, Debian, Arch only. ## Notes Low priority -- lfs is available on all supported platforms as a package. This is a rainy-day quality-of-life improvement. Refs: DAW/daw-lua-common#2
Author
Owner

Decision 2026-07-19: proceeding with this as the concrete implementation of #7 Option B. Scheduled for milestone 2.1, not 2.0.0 -- lfs is available on all currently supported platforms as a package, so this is a resilience improvement, not a blocker for the current release.

Decision 2026-07-19: proceeding with this as the concrete implementation of #7 Option B. Scheduled for milestone 2.1, not 2.0.0 -- lfs is available on all currently supported platforms as a package, so this is a resilience improvement, not a blocker for the current release.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-lua-common#3
No description provided.