diff options
| author | jakka <jakkadoujin@gmail.com> | 2025-06-19 11:14:37 +0300 |
|---|---|---|
| committer | jakka <jakkadoujin@gmail.com> | 2025-06-19 11:14:37 +0300 |
| commit | aa95671996bc55f69305505c5da2e715a85da189 (patch) | |
| tree | fd666125fb8532969e112cd07c9b44025183acf7 /src/files.rs | |
| parent | 024c3b3c06e6437977e884fb100489aa67d086fd (diff) | |
cleaned up abspath
Diffstat (limited to 'src/files.rs')
| -rw-r--r-- | src/files.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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<Path>, 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<u64> { - let (path, nocheck) = check_path(folderpath); + let (path, nocheck) = check_path(folderpath)?; let mut counter: u64 = 0; let stream = conn.get_toencode_stream().await?; |
