def is_dir.opened

bolt@1.27.0.0 · src/walk/disk.bend:56

import bolt@1.27.0.0/src/walk/disk.bend as Disk
import Base

56# a path that opened: read one byte and see; one that did not is no directory
57def is_dir.opened(rr: Result<&1, &1, U32 & String, File>) -> IO(Bool):
58  match rr:
59    case Fail{_e}:
60      IO.pure(Bool, False{})
61    case Done{file}:
62      do IO<Bool>:
63        got : File & Result<&1, &1, U32 & String, List<&2, U32>> <- File.read_bytes(file, 1)
64        is_dir.got(got)

Uses (12)

Used by (1)