From effbc56ec89875790b86cf6b1893ff2173546fc7 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 22 Aug 2019 19:52:57 +1200 Subject: [PATCH] Fix absolute ls --- src/shell/filesystem_shell.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shell/filesystem_shell.rs b/src/shell/filesystem_shell.rs index 949c972c56..f218ce01f2 100644 --- a/src/shell/filesystem_shell.rs +++ b/src/shell/filesystem_shell.rs @@ -110,7 +110,11 @@ impl Shell for FilesystemShell { for entry in entries { let entry = entry?; 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( filename, &entry.metadata()?,