From 7d2ab891809fc9220def2d2427cf9a22e549ea73 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Tue, 31 Mar 2026 10:56:20 +0200 Subject: [PATCH] Remove temp file using timestamp path Delete the temp entry at store_path/temp/ in both the hash-exists and success paths. Stop constructing the full filename with extension and remove the early process::exit to de-duplicate cleanup. --- src/main.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 240ea55..1da0cb3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,7 +77,7 @@ enum Source { // INFO: yt-dlp supports a lot of sites; so, when archiving (for example) a website, the user // -> should be asked whether they want to archive the whole website or just the video(s) on it. fn determine_source(path: &str) -> Source { - // INFO: Extractors' URLs can be found here: + // INFO: Extractor URLs can be found here: // -> https://github.com/yt-dlp/yt-dlp/tree/dfc0a84c192a7357dd1768cc345d590253a14fe5/yt_dlp/extractor // TEST: X posts can have multiple videos. @@ -272,13 +272,7 @@ fn main() -> Result<()> { // Dir or whatever. it's midnight and my brain ain't wording/braining. if hash_exists { println!("File already archived."); - let _ = fs::remove_file( - store_path - .join("temp") - .join(×tamp) - .join(format!("{timestamp}{file_extension}")), - ); - process::exit(0); + let _ = fs::remove_file(store_path.join("temp").join(×tamp)); } else { move_temp_to_raw( &store_path @@ -288,6 +282,7 @@ fn main() -> Result<()> { &hash, &store_path, )?; + let _ = fs::remove_file(store_path.join("temp").join(×tamp)); println!("File archived successfully."); }