From 4dafe910245d2d9c03de008825fb5559ff535ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Wed, 16 Mar 2016 15:12:41 -0700 Subject: [PATCH] Don't fail to create profile directory when it already exists --- src/profile_service.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/profile_service.rs b/src/profile_service.rs index 72350940..e442d6a0 100644 --- a/src/profile_service.rs +++ b/src/profile_service.rs @@ -7,6 +7,7 @@ use std::env; use std::fs; +use std::io::ErrorKind; pub struct ProfileService { profile_dir: String @@ -53,7 +54,9 @@ impl ProfileService { }, Err(_) => { fs::create_dir_all(dir.clone()).unwrap_or_else(|err| { - panic!("Unable to create directory {} : {}", dir, err); + if err.kind() != ErrorKind::AlreadyExists { + panic!("Unable to create directory {} : {}", dir, err); + } }); } }