Stream: beginners

Topic: Is Dir.list broken?


view this post on Zulip Asbjørn Olling (Nov 22 2023 at 23:20):

I'm trying to list the files in my current working directory, and it doesn't seem to work...
I figured I'd ask in here before opening a bug report on the basic-cli repo, in case I'm doing something wrong.
I'm pretty new to roc.

Env.cwd resolves into the correct path.
Task.await Env.cwd Dir.list fails with a NotSeekable error
Path.fromStr "." |> Dir.list fails with Other
Path.fromStr "./" |> Dir.list fails with Other
Path.fromStr "/" |> Dir.list fails with Other
Path.fromStr "/home/asbjorn" |> Dir.list fails with Other
Path.fromStr "/home/asbjorn/" |> Dir.list fails with Other

Using roc on commit 5e911f14d854a2e0c6a81b6a583076f9a3dcc5d9, built using the nix flake.
Using basic-cli 0.5.0, Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br (URL copied from the tutorial)
Running NixOS unstable on kernel version 6.1.62

view this post on Zulip Hannes (Nov 22 2023 at 23:22):

Luke Boswell said:

Yeah so Dir.list on basic cli is currently unimplemented and is returning an error tag rather than crashing or panicking in rust.

view this post on Zulip Asbjørn Olling (Nov 22 2023 at 23:28):

Ah, that makes sense then. Thanks.

view this post on Zulip Luke Boswell (Nov 22 2023 at 23:37):

Also see https://github.com/roc-lang/basic-cli/pull/136 which adds this feature. Will likely need a new release if you are using this from a URL package


Last updated: Jul 06 2025 at 12:14 UTC