Skip to content

Instantly share code, notes, and snippets.

@dreamer
Created September 3, 2019 15:17
Show Gist options
  • Save dreamer/a951e89907e85f3c37d57cd188787ce9 to your computer and use it in GitHub Desktop.
Save dreamer/a951e89907e85f3c37d57cd188787ce9 to your computer and use it in GitHub Desktop.
let json_files = fs::read_dir("metadata.lux")?
.take_while(|e| e.is_ok())
.map(|e| e.unwrap().path())
.take_while(|p| true);
//.take_while(|p| p.extension().unwrap() == "json");
for p in json_files {
println!(":: {:?} {} {:?} {:?}", p, p.ends_with("json"), p.extension().unwrap(), p.extension().unwrap() == "json");
}
// prints:
:: "metadata.lux/vkquake.files" false "files" false
:: "metadata.lux/vkquake.json" false "json" true
let json_files = fs::read_dir("metadata.lux")?
.take_while(|e| e.is_ok())
.map(|e| e.unwrap().path())
.take_while(|p| p.extension().unwrap() == "json");
//.take_while(|p| true);
for p in json_files {
println!(":: {:?} {} {:?} {:?}", p, p.ends_with("json"), p.extension().unwrap(), p.extension().unwrap() == "json");
}
// prints nothig!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment