std::env::home_dir is deprecated, use an alternative

This commit is contained in:
Wez Furlong committed 2018-07-11 08:29:11 -07:00
1 parent 8fae5f56a8
commit 6efce9943c
3 files changed
+9 -1

No files matched your search

+1
View File
@@ -20,6 +20,7 @@ serde = "1.0.27"
serde_derive = "1.0.27"
toml = "0.4.5"
unicode-width = "0.1.4"
directories = "~1.0"
[dependencies.term]
path = "term"
+7 -1
View File
@@ -1,5 +1,6 @@
//! Configuration for the gui portion of the terminal
use directories::UserDirs;
use failure::{err_msg, Error};
use std;
use std::fs;
@@ -175,8 +176,13 @@ pub struct StyleRule {
impl Config {
pub fn load() -> Result<Self, Error> {
let home = std::env::home_dir().ok_or_else(|| err_msg("can't find home dir"))?;
let dirs = UserDirs::new()
.ok_or_else(|| err_msg("can't find home dir"))?;
let home = dirs.home_dir();
// Note that the directories crate has methods for locating project
// specific config directories, but only returns one of them, not
// multiple. Not sure how feel about that.
let paths = [
home.join(".config").join("wezterm").join("wezterm.toml"),
home.join(".wezterm.toml"),
+1
View File
@@ -1,6 +1,7 @@
extern crate clap;
#[cfg(target_os = "macos")]
extern crate core_text;
extern crate directories;
extern crate euclid;
#[macro_use]
extern crate failure;