support custom db folder
This commit is contained in:
parent
7a3d3103e3
commit
9e522c5fb2
@ -156,13 +156,17 @@ impl fmt::Display for TextFilter {
|
|||||||
|
|
||||||
pub fn db_path() -> Result<&'static str, Box<dyn std::error::Error>> {
|
pub fn db_path() -> Result<&'static str, Box<dyn std::error::Error>> {
|
||||||
if let Some(path) = ARGS.db.clone() {
|
if let Some(path) = ARGS.db.clone() {
|
||||||
let absolute_path = if path.is_absolute() {
|
let mut absolute_path = if path.is_absolute() {
|
||||||
path
|
path
|
||||||
} else {
|
} else {
|
||||||
env::current_dir()?.join(path)
|
env::current_dir()?.join(path)
|
||||||
}
|
}
|
||||||
.clean();
|
.clean();
|
||||||
|
|
||||||
|
if absolute_path.is_dir() {
|
||||||
|
absolute_path = absolute_path.join("ffplayout.db");
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(abs_path) = absolute_path.parent() {
|
if let Some(abs_path) = absolute_path.parent() {
|
||||||
if abs_path.writable() {
|
if abs_path.writable() {
|
||||||
return Ok(Box::leak(
|
return Ok(Box::leak(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user