Fixed regression by ensuring directory cleanup creates directory if it does not exist.

This commit is contained in:
2024-07-04 20:13:16 -04:00
parent d206429bab
commit e1d09b7572

View File

@@ -303,9 +303,12 @@ func VerifyFFMpegPath(path string) error {
return nil 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) { func CleanupDirectory(path string) {
log.Traceln("Cleaning", path) 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) entries, err := ioutil.ReadDir(path)
if err != nil { if err != nil {
log.Fatalln("Unable to read contents of directory. Please check the ownership and permissions", err) log.Fatalln("Unable to read contents of directory. Please check the ownership and permissions", err)