Merge pull request #3904 from ethcore/new-dirs

Fixed upgrading keys on the first run
This commit is contained in:
Gav Wood 2016-12-19 22:24:37 +01:00 committed by GitHub
commit cd8af0a497
2 changed files with 3 additions and 5 deletions

@ -1 +1 @@
Subproject commit e8f4624b7f1a15c63674eecf577c7ab76c3b16be
Subproject commit 9028c4801fd39fbb71a9796979182549a24e81c8

View File

@ -139,9 +139,7 @@ fn file_exists(path: &Path) -> bool {
}
pub fn upgrade_key_location(from: &PathBuf, to: &PathBuf) {
let mut parent = to.clone();
parent.pop();
match fs::create_dir_all(&parent).and_then(|()| fs::read_dir(from)) {
match fs::create_dir_all(&to).and_then(|()| fs::read_dir(from)) {
Ok(entries) => {
let files: Vec<_> = entries.filter_map(|f| f.ok().and_then(|f| if f.file_type().ok().map_or(false, |f| f.is_file()) { f.file_name().to_str().map(|s| s.to_owned()) } else { None })).collect();
let mut num: usize = 0;
@ -165,7 +163,7 @@ pub fn upgrade_key_location(from: &PathBuf, to: &PathBuf) {
}
},
Err(e) => {
warn!("Error moving keys from {:?} to {:?}: {:?}", from, to, e);
debug!("Error moving keys from {:?} to {:?}: {:?}", from, to, e);
}
}
}