Skip to content

Commit

Permalink
always create directory
Browse files Browse the repository at this point in the history
  • Loading branch information
BusyJay committed Jun 16, 2016
1 parent b979f1c commit 81e5f3c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/raftstore/store/snap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,15 @@ impl SnapManagerCore {
}

pub fn try_recover(&self) -> io::Result<()> {
for path in try!(fs::read_dir(&self.base)) {
let path = Path::new(&self.base);
if !path.exists() {
try!(fs::create_dir_all(path));
}
if !path.is_dir() {
return Err(io::Error::new(ErrorKind::Other,
format!("{} should be a directory", path.display())));
}
for path in try!(fs::read_dir(path)) {
let p = try!(path);
if !try!(p.file_type()).is_file() {
continue;
Expand Down

0 comments on commit 81e5f3c

Please sign in to comment.