Replace std::env::home_dir with dirs::home_dir (#9077)
`std::env::home_dir` is deprecated but will probably take a while until it is deprecated on stable. For more info see https://github.com/rust-lang/rust/pull/51656
This commit is contained in:
committed by
Afri Schoedon
parent
9f1e08663d
commit
7e779327eb
@@ -15,6 +15,8 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Path utilities
|
||||
extern crate dirs;
|
||||
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -22,7 +24,7 @@ use std::path::PathBuf;
|
||||
/// Get the config path for application `name`.
|
||||
/// `name` should be capitalized, e.g. `"Ethereum"`, `"Parity"`.
|
||||
pub fn config_path(name: &str) -> PathBuf {
|
||||
let mut home = ::std::env::home_dir().expect("Failed to get home dir");
|
||||
let mut home = dirs::home_dir().expect("Failed to get home dir");
|
||||
home.push("Library");
|
||||
home.push(name);
|
||||
home
|
||||
@@ -32,7 +34,7 @@ pub fn config_path(name: &str) -> PathBuf {
|
||||
/// Get the config path for application `name`.
|
||||
/// `name` should be capitalized, e.g. `"Ethereum"`, `"Parity"`.
|
||||
pub fn config_path(name: &str) -> PathBuf {
|
||||
let mut home = ::std::env::home_dir().expect("Failed to get home dir");
|
||||
let mut home = dirs::home_dir().expect("Failed to get home dir");
|
||||
home.push("AppData");
|
||||
home.push("Roaming");
|
||||
home.push(name);
|
||||
@@ -43,7 +45,7 @@ pub fn config_path(name: &str) -> PathBuf {
|
||||
/// Get the config path for application `name`.
|
||||
/// `name` should be capitalized, e.g. `"Ethereum"`, `"Parity"`.
|
||||
pub fn config_path(name: &str) -> PathBuf {
|
||||
let mut home = ::std::env::home_dir().expect("Failed to get home dir");
|
||||
let mut home = dirs::home_dir().expect("Failed to get home dir");
|
||||
home.push(format!(".{}", name.to_lowercase()));
|
||||
home
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user