From e1d09b757252840a7c14e8c7e66911c52e182214 Mon Sep 17 00:00:00 2001 From: Logan Fick Date: Thu, 4 Jul 2024 20:13:16 -0400 Subject: [PATCH] Fixed regression by ensuring directory cleanup creates directory if it does not exist. --- utils/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/utils.go b/utils/utils.go index 6a8772537..1635dab73 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -303,9 +303,12 @@ func VerifyFFMpegPath(path string) error { return nil } -// CleanupDirectory removes all contents within the directory. Throws fatal error on failure. +// CleanupDirectory removes all contents within the directory, or creates it if it does not exist. Throws fatal error on failure. func CleanupDirectory(path string) { log.Traceln("Cleaning", path) + if err := os.MkdirAll(path, 0o750); err != nil { + log.Fatalln("Unable to create directory. Please check the ownership and permissions", err) + } entries, err := ioutil.ReadDir(path) if err != nil { log.Fatalln("Unable to read contents of directory. Please check the ownership and permissions", err)