Skip to content

Commit 84cfdb5

Browse files
committed
fix warning due to use of env::home_dir
1 parent c01b2a7 commit 84cfdb5

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ appveyor = { repository = "Stebalien/term" }
1919

2020
[dependencies]
2121
byteorder = "1.2.1"
22+
dirs = "1.0.2"
2223

2324
[target.'cfg(windows)'.dependencies]
2425
winapi = { version = "0.3", features = ["wincon", "handleapi", "fileapi"] }

src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@
5656
//! [win]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx
5757
//! [ti]: https://en.wikipedia.org/wiki/Terminfo
5858
59-
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
60-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
61-
html_root_url = "https://stebalien.github.io/doc/term/term/", test(attr(deny(warnings))))]
59+
#![doc(
60+
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
61+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
62+
html_root_url = "https://stebalien.github.io/doc/term/term/",
63+
test(attr(deny(warnings)))
64+
)]
6265
#![deny(missing_docs)]
6366
#![cfg_attr(test, deny(warnings))]
6467

6568
extern crate byteorder;
69+
extern crate dirs;
6670

6771
use std::io::prelude::*;
6872

src/terminfo/searcher.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use std::env;
1616
use std::fs;
1717
use std::path::PathBuf;
1818

19+
use dirs;
20+
1921
/// Return path to database entry for `term`
2022
pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
2123
let mut dirs_to_search = Vec::new();
@@ -56,7 +58,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
5658
// ~/.terminfo, ncurses will search /etc/terminfo, then
5759
// /lib/terminfo, and eventually /usr/share/terminfo.
5860
// On Haiku the database can be found at /boot/system/data/terminfo
59-
if let Some(mut homedir) = env::home_dir() {
61+
if let Some(mut homedir) = dirs::home_dir() {
6062
homedir.push(".terminfo");
6163
dirs_to_search.push(homedir)
6264
}

0 commit comments

Comments
 (0)