Fix display of wrong path

This commit is contained in:
daa 2017-05-13 21:59:56 +03:00
parent 6976635e86
commit 31731c6f5b
2 changed files with 8 additions and 4 deletions

2
Cargo.lock generated
View File

@ -1,6 +1,6 @@
[root] [root]
name = "nvim-gtk" name = "nvim-gtk"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -452,10 +452,14 @@ pub struct Entry {
} }
impl Entry { impl Entry {
fn new_project(name: &str, path: &str) -> Entry { fn new_project(name: &str, uri: &str) -> Entry {
let path = Path::new(uri);
Entry { Entry {
uri: path.to_owned(), uri: uri.to_owned(),
path: format!("<small>{}</small>", encode_minimal(path)), path: path.parent()
.map(|s| format!("<small>{}</small>", encode_minimal(&s.to_string_lossy())))
.unwrap_or("".to_owned()),
file_name: format!("<big>{}</big>", encode_minimal(name)), file_name: format!("<big>{}</big>", encode_minimal(name)),
name: name.to_owned(), name: name.to_owned(),
pixbuf: BOOKMARKED_PIXBUF, pixbuf: BOOKMARKED_PIXBUF,