fix(init): avoid TOCTTOU bug on syntax CSS dir
Fixes https://github.com/rust-lang/mdBook/pull/1652#discussion_r717622169
This commit is contained in:
parent
048042ff59
commit
1de4ab8939
|
@ -152,9 +152,7 @@ impl BookBuilder {
|
||||||
js.write_all(theme::JS)?;
|
js.write_all(theme::JS)?;
|
||||||
|
|
||||||
let syntax_dir = cssdir.join("syntax");
|
let syntax_dir = cssdir.join("syntax");
|
||||||
if !syntax_dir.exists() {
|
fs::create_dir_all(syntax_dir)?;
|
||||||
fs::create_dir(&syntax_dir)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut highlight_css = File::create(syntax_dir.join("light.css"))?;
|
let mut highlight_css = File::create(syntax_dir.join("light.css"))?;
|
||||||
highlight_css.write_all(theme::SYNTAX_LIGHT_CSS)?;
|
highlight_css.write_all(theme::SYNTAX_LIGHT_CSS)?;
|
||||||
|
|
Loading…
Reference in New Issue