Fixed usage of a partition pointing to a file instead of a folder

This commit is contained in:
Lucien Greathouse
2017-12-07 14:42:30 -08:00
parent cafb547894
commit 7042680a0a
2 changed files with 8 additions and 2 deletions

View File

@@ -62,7 +62,12 @@ impl Vfs {
None => return None,
};
let full_path = {
// It's possible that the partition points to a file if `rest` is empty.
// Joining "" onto a path will put a trailing slash on, which causes
// file reads to fail.
let full_path = if rest.is_empty() {
partition.clone()
} else {
let joined = rest.join("/");
let relative = Path::new(&joined);