Post: use dirs crate, avoiding compile warning about home_dir

This commit is contained in:
Grisha Kruglov 2018-08-20 13:45:45 -07:00 committed by Grisha Kruglov
parent 22b17a6779
commit 66cc4e14ad
2 changed files with 3 additions and 1 deletions

View file

@ -20,6 +20,7 @@ test = false
[dependencies]
combine = "2.2.2"
dirs = "1.0.3"
env_logger = "0.5"
failure = "0.1.1"
failure_derive = "0.1.1"

View file

@ -20,6 +20,7 @@ use std::path::{
extern crate combine;
extern crate env_logger;
extern crate dirs;
extern crate failure;
extern crate getopts;
extern crate linefeed;
@ -46,7 +47,7 @@ static HISTORY_FILE_PATH: &str = ".mentat_history";
/// This accords with main other tools which prefix with "." and suffix with "_history": lein,
/// node_repl, python, and sqlite, at least.
pub(crate) fn history_file_path() -> PathBuf {
let mut p = ::std::env::home_dir().unwrap_or_default();
let mut p = dirs::home_dir().unwrap_or_default();
p.push(::HISTORY_FILE_PATH);
p
}