Skip to content

Commit

Permalink
Add trailing slash when autocompleting dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc committed Nov 15, 2020
1 parent b640623 commit 0c50dce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/user/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,10 @@ impl Shell {
}
} else if let Some(dir) = kernel::fs::Dir::open(dirname) {
for entry in dir.read() {
if entry.name().starts_with(filename) {
self.autocomplete.push(format!("{}{}{}", dirname, sep, entry.name()));
let name = entry.name();
if name.starts_with(filename) {
let end = if entry.is_dir() { "/" } else { "" };
self.autocomplete.push(format!("{}{}{}{}", dirname, sep, name, end));
}
}
}
Expand Down

0 comments on commit 0c50dce

Please sign in to comment.