// Directory listing (std/file, issue #179): the crate's own directory // holds its manifest and sources; a missing path is an `Error`, not a // panic. The entries' order is unspecified, so only membership is // checked. (Both backends run this with the crate's directory as the // working directory.) import std/file import std/io import std/list pub fn main :: -> () / { match file.list_dir "." { Ok(entries) -> { io.println (show (list.any entries fn e { e == "Cargo.toml" })) io.println (show (list.any entries fn e { e == "src" })) io.println (show (list.any entries fn e { e == "." })) } , Error(e) -> io.println e } match file.list_dir "/definitely/not/here" { Ok(_) -> io.println "unexpected", Error(_) -> io.println "Error" } } //> True //> True //> False //> Error