Skip to content

Commit

Permalink
Merge pull request #223 from fabricedesre/profile-creation
Browse files Browse the repository at this point in the history
Don't fail to create profile directory when it already exists
  • Loading branch information
fabricedesre committed Mar 16, 2016
2 parents bafb8f1 + 4dafe91 commit d1f8c76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/profile_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use std::env;
use std::fs;
use std::io::ErrorKind;

pub struct ProfileService {
profile_dir: String
Expand Down Expand Up @@ -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);
}
});
}
}
Expand Down

0 comments on commit d1f8c76

Please sign in to comment.