Removed depricated crate tempdir and replaced it with tempfile.

This commit is contained in:
NA 2024-01-30 15:12:16 +00:00
parent 207770a1dd
commit d3de7f645b
4 changed files with 14 additions and 76 deletions

76
Cargo.lock generated
View file

@ -556,12 +556,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]] [[package]]
name = "futf" name = "futf"
version = "0.1.5" version = "0.1.5"
@ -1185,7 +1179,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [ dependencies = [
"base64ct", "base64ct",
"rand_core 0.6.4", "rand_core",
"subtle", "subtle",
] ]
@ -1249,7 +1243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
dependencies = [ dependencies = [
"phf_shared 0.10.0", "phf_shared 0.10.0",
"rand 0.8.5", "rand",
] ]
[[package]] [[package]]
@ -1259,7 +1253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [ dependencies = [
"phf_shared 0.11.2", "phf_shared 0.11.2",
"rand 0.8.5", "rand",
] ]
[[package]] [[package]]
@ -1353,19 +1347,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rand"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
dependencies = [
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"rdrand",
"winapi",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.8.5" version = "0.8.5"
@ -1374,7 +1355,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha",
"rand_core 0.6.4", "rand_core",
] ]
[[package]] [[package]]
@ -1384,24 +1365,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core 0.6.4", "rand_core",
] ]
[[package]]
name = "rand_core"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
dependencies = [
"rand_core 0.4.2",
]
[[package]]
name = "rand_core"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.6.4" version = "0.6.4"
@ -1411,15 +1377,6 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
dependencies = [
"rand_core 0.3.1",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.4.1" version = "0.4.1"
@ -1458,15 +1415,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.23" version = "0.11.23"
@ -1522,7 +1470,7 @@ dependencies = [
[[package]] [[package]]
name = "royal_road_archiver" name = "royal_road_archiver"
version = "1.0.1" version = "1.0.2"
dependencies = [ dependencies = [
"bytes", "bytes",
"chrono", "chrono",
@ -1536,7 +1484,7 @@ dependencies = [
"reqwest", "reqwest",
"scraper", "scraper",
"serde_json", "serde_json",
"tempdir", "tempfile",
"thiserror", "thiserror",
"url", "url",
"zip-extract", "zip-extract",
@ -1879,16 +1827,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "tempdir"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
dependencies = [
"rand 0.4.6",
"remove_dir_all",
]
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.9.0" version = "3.9.0"

View file

@ -4,8 +4,8 @@ version = "1.0.2"
edition = "2021" edition = "2021"
description = "An archival program and library for the webnovel site RoyalRoad." description = "An archival program and library for the webnovel site RoyalRoad."
repository = "https://github.com/Raine-gay/royal_road_archiver" repository = "https://github.com/Raine-gay/royal_road_archiver"
license = "EUPL-1.2" license = "EUPL-1.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.release] [profile.release]
@ -36,7 +36,7 @@ regex = "1.10.3"
reqwest = { version = "0.11.23", features = ["blocking", "rustls"] } reqwest = { version = "0.11.23", features = ["blocking", "rustls"] }
scraper = "0.18.1" scraper = "0.18.1"
serde_json = "1.0.111" serde_json = "1.0.111"
tempdir = "0.3.7" tempfile = "3.9.0"
thiserror = "1.0.56" thiserror = "1.0.56"
url = "2.5.0" url = "2.5.0"
zip-extract = "0.1.3" zip-extract = "0.1.3"

View file

@ -1,7 +1,7 @@
use std::{io::Cursor, path::PathBuf}; use std::{io::Cursor, path::PathBuf};
use path_slash::PathBufExt as _; use path_slash::PathBufExt as _;
use tempdir::TempDir; use tempfile::TempDir;
use crate::{misc, GenerationError, Warning, WARNINGS}; use crate::{misc, GenerationError, Warning, WARNINGS};
@ -34,7 +34,7 @@ pub fn setup_html2xhtml() -> Result<TempDir, GenerationError> {
#[cfg(target_os = "windows")] { #[cfg(target_os = "windows")] {
const HTML2XHTML: &[u8; 245025] = include_bytes!("../html2xhtml-windows.zip"); // This will not compile on windows due to this and no I don't give a shit. const HTML2XHTML: &[u8; 245025] = include_bytes!("../html2xhtml-windows.zip"); // This will not compile on windows due to this and no I don't give a shit.
// Compile it on linux for windows like a sane person. // Compile it on linux for windows like a sane person.
let html2xhtml_temp_dir = match TempDir::new("html2xhtml-windows") { let html2xhtml_temp_dir = match TempDir::new() {
Ok(temp_dir) => temp_dir, Ok(temp_dir) => temp_dir,
Err(error) => return Err(GenerationError::TempDirCreationError {error}), Err(error) => return Err(GenerationError::TempDirCreationError {error}),
}; };
@ -49,7 +49,7 @@ pub fn setup_html2xhtml() -> Result<TempDir, GenerationError> {
#[cfg(target_os = "linux")] { #[cfg(target_os = "linux")] {
const HTML2XHTML: &[u8; 186938] = include_bytes!("../html2xhtml-linux.zip"); const HTML2XHTML: &[u8; 186938] = include_bytes!("../html2xhtml-linux.zip");
let html2xhtml_temp_dir = match TempDir::new("html2xhtml-linux") { let html2xhtml_temp_dir = match TempDir::new() {
Ok(temp_dir) => temp_dir, Ok(temp_dir) => temp_dir,
Err(error) => return Err(GenerationError::TempDirCreationError {error}), Err(error) => return Err(GenerationError::TempDirCreationError {error}),
}; };

View file

@ -2,7 +2,7 @@ use std::{collections::HashMap, io::Write, process::{Command, Stdio}};
use regex::Regex; use regex::Regex;
use scraper::{Html, Selector}; use scraper::{Html, Selector};
use tempdir::TempDir; use tempfile::TempDir;
use url::Url; use url::Url;
use crate::{http, misc::HashMapExt, GenerationError, Warning, WARNINGS}; use crate::{http, misc::HashMapExt, GenerationError, Warning, WARNINGS};