From 03c29b9a6f5b00a5116fe10e96e2738dfa5db07a Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Fri, 23 Aug 2019 04:44:31 +1200 Subject: [PATCH] Remove an unwrap --- 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 0c686f97d..2d1eb977b 100644 --- a/src/shell/filesystem_shell.rs +++ b/src/shell/filesystem_shell.rs @@ -135,7 +135,11 @@ impl Shell for FilesystemShell { // Enumerate the entries from the glob and add each for entry in entries { if let Ok(entry) = entry { - let filename = entry.strip_prefix(&cwd).unwrap(); + let filename = if let Ok(fname) = entry.strip_prefix(&cwd) { + fname + } else { + Path::new(&entry) + }; let metadata = std::fs::metadata(&entry)?; let value = dir_entry_dict( filename,