15
15
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
16
16
17
17
//! Path utilities
18
+ extern crate dirs;
19
+
18
20
use std:: path:: Path ;
19
21
use std:: path:: PathBuf ;
20
22
21
23
#[ cfg( target_os = "macos" ) ]
22
24
/// Get the config path for application `name`.
23
25
/// `name` should be capitalized, e.g. `"Ethereum"`, `"Parity"`.
24
26
pub fn config_path ( name : & str ) -> PathBuf {
25
- let mut home = :: std :: env :: home_dir ( ) . expect ( "Failed to get home dir" ) ;
27
+ let mut home = dirs :: home_dir ( ) . expect ( "Failed to get home dir" ) ;
26
28
home. push ( "Library" ) ;
27
29
home. push ( name) ;
28
30
home
@@ -32,7 +34,7 @@ pub fn config_path(name: &str) -> PathBuf {
32
34
/// Get the config path for application `name`.
33
35
/// `name` should be capitalized, e.g. `"Ethereum"`, `"Parity"`.
34
36
pub fn config_path ( name : & str ) -> PathBuf {
35
- let mut home = :: std :: env :: home_dir ( ) . expect ( "Failed to get home dir" ) ;
37
+ let mut home = dirs :: home_dir ( ) . expect ( "Failed to get home dir" ) ;
36
38
home. push ( "AppData" ) ;
37
39
home. push ( "Roaming" ) ;
38
40
home. push ( name) ;
@@ -43,7 +45,7 @@ pub fn config_path(name: &str) -> PathBuf {
43
45
/// Get the config path for application `name`.
44
46
/// `name` should be capitalized, e.g. `"Ethereum"`, `"Parity"`.
45
47
pub fn config_path ( name : & str ) -> PathBuf {
46
- let mut home = :: std :: env :: home_dir ( ) . expect ( "Failed to get home dir" ) ;
48
+ let mut home = dirs :: home_dir ( ) . expect ( "Failed to get home dir" ) ;
47
49
home. push ( format ! ( ".{}" , name. to_lowercase( ) ) ) ;
48
50
home
49
51
}
0 commit comments