Last active
July 18, 2016 21:51
-
-
Save devth/3421a5d6eef2fbcd613c2f36bbac69e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fs; | |
use std::io; | |
use std::path::PathBuf; | |
fn main() { | |
let dir = env!("DIR").to_string(); | |
println!("Looking in {}", dir); | |
let _ = loop_dir_contents(&dir); | |
} | |
fn loop_dir_contents(dir: &String) -> io::Result<()> { | |
for entry in try!(fs::read_dir(dir)) { | |
let app = try!(entry); | |
if app.path().is_dir() { | |
let _ = create_config_map(dir, app.path()); | |
} | |
} | |
Ok(()) | |
} | |
fn create_config_map(root: &String, app_path: PathBuf) -> io::Result<()> { | |
match app_path.file_name() { | |
Some(app_os_str) => { | |
let app = app_os_str.to_str().unwrap(); | |
println!("Create ConfigMap for {}/{}", root, app); | |
for entry in try!(fs::read_dir(format!("{}/{}", root, app))) { | |
let file = try!(entry); | |
println!("{:?}", file.path()); | |
} | |
} | |
None => { | |
println!("No path for {} {:?}", root, app_path); | |
} | |
} | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment