Generate a JSON tree based on the provided path
File structure:
/
L src/
L lib.rs
let res = generate_directory_tree("./src");
assert_eq!(serde_json::to_string(&res), r#"{"/":["lib.rs"]}"#);
File structure:
/
L src/
L baz/
L page.rs
L foo/
L bar/
L page.rs
L page.rs
L 404.rs
L layout.rs
L page.rs
let res = generate_directory_tree("./src");
assert_eq!(serde_json::to_pretty_string(&res), r#"
{
"/": [
"404.rs",
"layout.rs",
"page.rs"
],
"/baz": [
"page.rs"
],
"/foo": [
"page.rs"
],
"/foo/bar": [
"page.rs"
]
}"#);