From 84cfdb51775b327fedf21784749d862fdffa10b4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 27 Jul 2018 16:30:29 -0700 Subject: [PATCH] fix warning due to use of env::home_dir --- Cargo.toml | 1 + src/lib.rs | 10 +++++++--- src/terminfo/searcher.rs | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a8a2e15e..f765a271 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ appveyor = { repository = "Stebalien/term" } [dependencies] byteorder = "1.2.1" +dirs = "1.0.2" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["wincon", "handleapi", "fileapi"] } diff --git a/src/lib.rs b/src/lib.rs index d8c1e7a6..f28699d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,13 +56,17 @@ //! [win]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx //! [ti]: https://en.wikipedia.org/wiki/Terminfo -#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", - html_favicon_url = "https://doc.rust-lang.org/favicon.ico", - html_root_url = "https://stebalien.github.io/doc/term/term/", test(attr(deny(warnings))))] +#![doc( + html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://doc.rust-lang.org/favicon.ico", + html_root_url = "https://stebalien.github.io/doc/term/term/", + test(attr(deny(warnings))) +)] #![deny(missing_docs)] #![cfg_attr(test, deny(warnings))] extern crate byteorder; +extern crate dirs; use std::io::prelude::*; diff --git a/src/terminfo/searcher.rs b/src/terminfo/searcher.rs index 76865748..27eabaa3 100644 --- a/src/terminfo/searcher.rs +++ b/src/terminfo/searcher.rs @@ -16,6 +16,8 @@ use std::env; use std::fs; use std::path::PathBuf; +use dirs; + /// Return path to database entry for `term` pub fn get_dbpath_for_term(term: &str) -> Option { let mut dirs_to_search = Vec::new(); @@ -56,7 +58,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option { // ~/.terminfo, ncurses will search /etc/terminfo, then // /lib/terminfo, and eventually /usr/share/terminfo. // On Haiku the database can be found at /boot/system/data/terminfo - if let Some(mut homedir) = env::home_dir() { + if let Some(mut homedir) = dirs::home_dir() { homedir.push(".terminfo"); dirs_to_search.push(homedir) }