I have a set of Cargo crates in a workspace which is structured as below:
project1
|- app-context
| |- src/lib.rs
| |- Cargo.toml
|- config
| |-development.toml
|Cargo.toml
I am running a function in lib.rs
using rust tests which print the folders and files in the folder using
let paths = fs::read_dir("./").unwrap();
for path in paths {
println!("Name: {}", path.unwrap().path().display())
}
The output I get is src
& Cargo.toml
. But the result I expect is app-context
& config
.
What am I doing wrong here?
How do I set the default working directory to the folder containing all my crates rather than pointing to a particular workspace?