Created first disk

This commit is contained in:
2023-10-26 11:43:05 +02:00
parent 081b0f7784
commit bdb2f6427d
14 changed files with 393 additions and 25 deletions

@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::path::Path;
const INVALID_CHARS: [&str; 19] = [
"@", "\\", "/", ":", ",", "<", ">", "%", "'", "\"", "?", "{", "}", "$", "*", "|", ";", "=",
@ -11,7 +11,8 @@ pub fn check_file_name(name: &str) -> bool {
}
/// Create directory if missing
pub fn create_directory_if_missing(path: &PathBuf) -> anyhow::Result<()> {
pub fn create_directory_if_missing<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
let path = path.as_ref();
if !path.exists() {
std::fs::create_dir_all(path)?;
}