Merge pull request #332 from jonathandturner/fix_abs_ls

Fix absolute ls
This commit is contained in:
Jonathan Turner 2019-08-22 20:18:21 +12:00 committed by GitHub
commit 399b411a9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,11 @@ impl Shell for FilesystemShell {
for entry in entries { for entry in entries {
let entry = entry?; let entry = entry?;
let filepath = entry.path(); let filepath = entry.path();
let filename = filepath.strip_prefix(&cwd).unwrap(); let filename = if let Ok(fname) = filepath.strip_prefix(&cwd) {
fname
} else {
Path::new(&filepath)
};
let value = dir_entry_dict( let value = dir_entry_dict(
filename, filename,
&entry.metadata()?, &entry.metadata()?,