This commit is contained in:
thePR0M3TH3AN
2025-05-21 20:14:56 -04:00
parent 2a388e980f
commit 99f72af4bc

View File

@@ -60,8 +60,7 @@ match args.command {
Commands::Init => { Commands::Init => {
info!("Database initialised at {}", cfg.db_path.display()); info!("Database initialised at {}", cfg.db_path.display());
let cwd = env::current_dir().context("getting current directory")?; let cwd = env::current_dir().context("getting current directory")?;
let count = let count = scan::scan_directory(&mut conn, &cwd).context("initial scan failed")?;
scan::scan_directory(&mut conn, &cwd).context("initial scan failed")?;
info!("Initial scan complete indexed/updated {count} files"); info!("Initial scan complete indexed/updated {count} files");
} }
@@ -76,11 +75,8 @@ match args.command {
if dirty { if dirty {
let dirty_ids = take_dirty(&conn)?; let dirty_ids = take_dirty(&conn)?;
for id in dirty_ids { for id in dirty_ids {
let path: String = conn.query_row( let path: String =
"SELECT path FROM files WHERE id = ?1", conn.query_row("SELECT path FROM files WHERE id = ?1", [id], |r| r.get(0))?;
[id],
|r| r.get(0),
)?;
scan::scan_directory(&mut conn, Path::new(&path))?; scan::scan_directory(&mut conn, Path::new(&path))?;
} }
} else { } else {
@@ -155,6 +151,7 @@ match args.command {
} }
Ok(()) Ok(())
}
/* ─────────────────── helpers & sub-routines ─────────────────── */ /* ─────────────────── helpers & sub-routines ─────────────────── */