support custom db folder

This commit is contained in:
jb-alvarado 2024-07-04 15:09:50 +02:00
parent 7a3d3103e3
commit 9e522c5fb2

View File

@ -156,13 +156,17 @@ impl fmt::Display for TextFilter {
pub fn db_path() -> Result<&'static str, Box<dyn std::error::Error>> {
if let Some(path) = ARGS.db.clone() {
let absolute_path = if path.is_absolute() {
let mut absolute_path = if path.is_absolute() {
path
} else {
env::current_dir()?.join(path)
}
.clean();
if absolute_path.is_dir() {
absolute_path = absolute_path.join("ffplayout.db");
}
if let Some(abs_path) = absolute_path.parent() {
if abs_path.writable() {
return Ok(Box::leak(