From fe04a4dbd664791b69164f9e8085b495823b4c1b Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Sat, 3 Apr 2021 14:57:51 +1300 Subject: [PATCH] Fix temporary file removal again --- tools/files.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/files.py b/tools/files.py index 66ae099..92cc474 100644 --- a/tools/files.py +++ b/tools/files.py @@ -4,7 +4,12 @@ def get_created_files(id): if id[0] == "-": id = "_" + id[1:] # youtube-dl changes - to _ at the start, presumably to not accidentally trigger switches with * in shell id += "_" - trim_id = id.lstrip("-_") + + # youtube-dl thinks it's a really good idea to do this, for some reason. + trim_id = id.lstrip("_") + if trim_id.startswith("-"): + trim_id = "_" + trim_id[len("-"):] + return (f for f in os.listdir() if f.startswith(id) or f.startswith(trim_id)) def clean_up_temp_files(id):