mirror of
https://github.com/babichjacob/ac-qu-ai-nt.git
synced 2025-10-01 16:37:53 -04:00
feat!: this is the correct way to format a breaking change unlike my previous commit - ensure the application data directory, and the tracing directory within it, exists
this is a BREAKING CHANGE because the application will now crash if either directory cannot be created due to some I/O / filesystem error
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::path::PathBuf;
|
||||
use std::{fs::create_dir_all, io::ErrorKind, path::PathBuf};
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
@@ -13,7 +13,27 @@ struct Args {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
let Args {
|
||||
application_data_directory,
|
||||
} = Args::parse();
|
||||
|
||||
match create_dir_all(&application_data_directory) {
|
||||
Ok(()) => {}
|
||||
Err(e) if e.kind() == ErrorKind::AlreadyExists => {}
|
||||
Err(e) => {
|
||||
panic!("{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
let tracing_directory = application_data_directory.join("logs");
|
||||
|
||||
match create_dir_all(&tracing_directory) {
|
||||
Ok(()) => {}
|
||||
Err(e) if e.kind() == ErrorKind::AlreadyExists => {}
|
||||
Err(e) => {
|
||||
panic!("{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "cli-clap")]
|
||||
ac_qu_ai_nt_cli_clap::main();
|
||||
|
Reference in New Issue
Block a user