Skip to content

nu::fs layer | Good beginner issue #3199

@LhKipp

Description

@LhKipp

Currently our implementation uses std::fs::* and std::env::* to interact with the filesystem / environment. The problem is, that std::fs::* / std::env::* returns io::Result, while Nushell has its own error type. That leads to either everyone automatically returning the error in a ShellError::untagged_runtime_error() (little ugly), or write a custom conversion.

I would like to have a simple lib, wrapping std::fs, std::env, so we don't come up with 20 different error messages.

This would be best implemented in a new crate (we keep them under crates/). Copying the Cargo.toml file of nu-value-ext could be a good starting point.

I don't need a wrapper around whole std::fs, std::env. Read, write, current_dir, canonicalize would be sufficient for the start.

There is already a wrapper around canonicalize in nu-engine/src/filesystem/path.rs. However it returns io::Error. This function could potentially be moved into nu::fs.

Feel free to ask me for help, if needed, in our Discord (@LhKipp)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions