-
Notifications
You must be signed in to change notification settings - Fork 2.1k
nu::fs layer | Good beginner issue #3199
Description
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)