init v.1.0.0
All checks were successful
CI / Check / Test (push) Successful in 3m40s

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-08-06 20:11:22 +02:00
commit 15fdace324
38 changed files with 2883 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#![allow(dead_code)]
use std::{
fs,
path::{Path, PathBuf},
};
pub const LOGO_BYTES: &[u8] = b"pretend png";
pub fn path(value: &str) -> Option<PathBuf> {
Some(PathBuf::from(value))
}
pub fn env_of(pairs: &[(&str, &str)]) -> impl Fn(&str) -> Option<PathBuf> + use<> {
let pairs: Vec<(String, PathBuf)> = pairs
.iter()
.map(|(key, value)| ((*key).to_owned(), PathBuf::from(value)))
.collect();
move |key| {
pairs
.iter()
.find(|(name, _)| name == key)
.map(|(_, value)| value.clone())
}
}
pub fn scratch(name: &str) -> PathBuf {
let directory = std::env::temp_dir().join(format!("dvd-thing-test-{name}"));
let _ = fs::remove_dir_all(&directory);
fs::create_dir_all(&directory).expect("temp directory must be creatable");
directory
}
pub fn write_logo(directory: &Path) -> PathBuf {
let file = directory.join("logo.png");
fs::write(&file, LOGO_BYTES).expect("temp file must be writable");
file
}