We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9332d1b commit c62956dCopy full SHA for c62956d
src/main.rs
@@ -11,9 +11,10 @@ use rayon::{
11
};
12
use request::{Client, Response};
13
use std::{
14
- fs::File,
+ fs::{self, File},
15
io::{Read, Write},
16
num::{NonZeroU32, NonZeroUsize},
17
+ os,
18
path::Path,
19
thread,
20
time::Duration,
@@ -125,9 +126,15 @@ fn read_body_from_file(file_path: &str) -> Result<Vec<u8>> {
125
126
127
fn write_to_csv(path: &str, res: &[Response]) -> Result<()> {
128
let pth = Path::new(&path);
129
+
130
let mut f = if pth.exists() {
131
File::options().append(true).open(pth)
132
} else {
133
+ if let Some(parent) = pth.parent() {
134
+ if !parent.exists() {
135
+ fs::create_dir_all(parent)?;
136
+ }
137
138
File::create(pth)
139
}?;
140
0 commit comments