Skip to content

Commit 1b8af2b

Browse files
committed
Fix #120 destination and source directories can now be constructed correctly even if multiple directories do not exist on the path
1 parent 7f34512 commit 1b8af2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/book/mdbook.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ impl MDBook {
118118

119119
if !self.dest.exists() {
120120
debug!("[*]: {:?} does not exist, trying to create directory", self.dest);
121-
try!(fs::create_dir(&self.dest));
121+
try!(fs::create_dir_all(&self.dest));
122122
}
123123

124124
if !self.src.exists() {
125125
debug!("[*]: {:?} does not exist, trying to create directory", self.src);
126-
try!(fs::create_dir(&self.src));
126+
try!(fs::create_dir_all(&self.src));
127127
}
128128

129129
let summary = self.src.join("SUMMARY.md");
@@ -132,7 +132,7 @@ impl MDBook {
132132

133133
// Summary does not exist, create it
134134

135-
debug!("[*]: {:?} does not exist, trying to create SUMMARY.md", src.join("SUMMARY.md"));
135+
debug!("[*]: {:?} does not exist, trying to create SUMMARY.md", self.src.join("SUMMARY.md"));
136136
let mut f = try!(File::create(&self.src.join("SUMMARY.md")));
137137

138138
debug!("[*]: Writing to SUMMARY.md");

0 commit comments

Comments
 (0)