From aa95671996bc55f69305505c5da2e715a85da189 Mon Sep 17 00:00:00 2001 From: jakka Date: Thu, 19 Jun 2025 11:14:37 +0300 Subject: cleaned up abspath --- src/files.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/files.rs') diff --git a/src/files.rs b/src/files.rs index 743e489..045c5b4 100644 --- a/src/files.rs +++ b/src/files.rs @@ -105,16 +105,16 @@ pub async fn index_files_recursively(path: impl AsRef, conn: &Database) -> Ok(()) } -fn check_path(folderpath: Option<&PathBuf>) -> (PathBuf, bool) { +fn check_path(folderpath: Option<&PathBuf>) -> Result<(PathBuf, bool)> { if let Some(real_path) = folderpath { - (real_path.to_owned(), false) + Ok((real_path.canonicalize()?, false)) } else { - (PathBuf::new(), true) + Ok((PathBuf::new(), true)) } } pub async fn reencode_files(folderpath: Option<&PathBuf>, conn: &Database) -> Result<()> { - let (path, nocheck) = check_path(folderpath); + let (path, nocheck) = check_path(folderpath)?; let stream = conn.get_toencode_stream().await?; pin_mut!(stream); @@ -159,7 +159,7 @@ pub async fn reencode_files(folderpath: Option<&PathBuf>, conn: &Database) -> Re } pub async fn count_reencode_files(folderpath: Option<&PathBuf>, conn: &Database) -> Result { - let (path, nocheck) = check_path(folderpath); + let (path, nocheck) = check_path(folderpath)?; let mut counter: u64 = 0; let stream = conn.get_toencode_stream().await?; -- cgit v1.3.1