Filesystem shell can't cd into files. Ever.

This commit is contained in:
Andrés N. Robalino
2019-09-24 15:34:30 -05:00
parent ffa536bea3
commit 837d12decd
2 changed files with 30 additions and 7 deletions

View File

@ -187,6 +187,14 @@ impl Shell for FilesystemShell {
} else {
let path = PathBuf::from(self.path());
if target.exists() && !target.is_dir() {
return Err(ShellError::labeled_error(
"Can not change to directory",
"is not a directory",
v.tag().clone(),
));
}
match dunce::canonicalize(path.join(&target)) {
Ok(p) => p,
Err(_) => {