Reformatted directory cleanup function.

This commit is contained in:
Logan Fick 2024-07-06 12:18:56 -04:00
parent a9d1217db7
commit d8344da524
No known key found for this signature in database
GPG Key ID: 43E58A0C922AB7D1

View File

@ -306,17 +306,17 @@ func VerifyFFMpegPath(path string) error {
func CleanupDirectory(path string) {
log.Traceln("Cleaning", path)
if err := os.MkdirAll(path, 0o750); err != nil {
log.Fatalf("Unable to create '%s'. Please check the ownership and permissions: %s\n", path, err)
log.Fatalf("Unable to create '%s'. Please check the ownership and permissions: %s\n", path, err)
}
entries, err := os.ReadDir(path)
if err != nil {
log.Fatalf("Unable to read contents of '%s'. Please check the ownership and permissions: %s\n", path, err)
log.Fatalf("Unable to read contents of '%s'. Please check the ownership and permissions: %s\n", path, err)
}
for _, entry := range entries {
entryPath := filepath.Join(path, entry.Name())
if err := os.RemoveAll(entryPath); err != nil {
log.Fatalf("Unable to remove file or directory contained in '%s'. Please check the ownership and permissions: %s\n", path, err)
}
entryPath := filepath.Join(path, entry.Name())
if err := os.RemoveAll(entryPath); err != nil {
log.Fatalf("Unable to remove file or directory contained in '%s'. Please check the ownership and permissions: %s\n", path, err)
}
}
}