Drop info.txt on new downloads

This commit is contained in:
blank X 2020-12-02 00:33:26 +07:00
parent 8a67b74ce2
commit da1f6365e2
1 changed files with 4 additions and 2 deletions

View File

@ -7,7 +7,7 @@ use std::process::exit;
use tokio::task::JoinHandle;
use std::collections::HashMap;
use tokio::sync::{mpsc, oneshot};
use std::fs::{rename, create_dir};
use std::fs::{rename, create_dir, write};
extern crate tokio;
extern crate reqwest;
@ -34,7 +34,9 @@ pub async fn run(args: env::Args) {
let base_path = sauce_info.id.to_string();
let base_path = Path::new(&base_path);
match create_dir(base_path) {
Ok(()) => (),
Ok(()) => {
write(base_path.join("info.txt"), format!("{}\n", utils::human_sauce_info(&sauce_info))).unwrap();
},
Err(err) => match err.kind() {
std::io::ErrorKind::AlreadyExists => (),
_ => panic!("Got a weird error while creating dir: {}", err)