Fix welcome command

This commit is contained in:
Csonka Mihaly 2020-03-22 22:54:02 +01:00
parent 4bfc2e5a6c
commit a625b0aea0

View file

@ -227,18 +227,18 @@ pub fn read_all(
let folders = paths_from_path_param(&paths);
for folder in folders {
let dir_entries = fs::read_dir(folder).map_err(|e| UnreadableDir::new(folder, e))?;
for entry in dir_entries {
let path = entry.map_err(|e| UnreadableDir::new(folder, e))?.path();
let path_str = path
.to_str()
.ok_or_else(|| InvalidPath(path.to_path_buf()))?;
if path_str.ends_with(".cheat")
&& read_file(path_str, &mut variables, &mut visited_lines, stdin).is_ok()
&& !found_something
{
found_something = true;
if let Ok(dir_entries) = fs::read_dir(folder) {
for entry in dir_entries {
let path = entry.map_err(|e| UnreadableDir::new(folder, e))?.path();
let path_str = path
.to_str()
.ok_or_else(|| InvalidPath(path.to_path_buf()))?;
if path_str.ends_with(".cheat")
&& read_file(path_str, &mut variables, &mut visited_lines, stdin).is_ok()
&& !found_something
{
found_something = true;
}
}
}
}