From fd0e88220b099ded8359fe98734b367f1e7e4383 Mon Sep 17 00:00:00 2001 From: Jamison Lahman Date: Sat, 21 Dec 2024 00:59:35 -0800 Subject: [PATCH] chore: remove soundPath on download error --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index 0c893bf..e1f95cf 100644 --- a/main.go +++ b/main.go @@ -259,6 +259,7 @@ func playSound(dataDir string, sound Sound) (*beep.Ctrl, *os.File, beep.StreamSe if os.IsNotExist(err) { err := downloadFileWithProgress(sound.url, soundPath) if err != nil { + os.Remove(soundPath) return nil, nil, nil, nil, fmt.Errorf("Error downloading sound: %v", err) } file, err = os.Open(soundPath)