mirror of
https://github.com/owncast/owncast.git
synced 2025-11-02 11:56:57 +08:00
proper cleanup and permission check for the hls directory (#1167)
* check error on hls cleanup * rm HLS directories before creating new ones * don't mask the variable * mv cleanupDirectory() to utils * add user-friendly error messages
This commit is contained in:
@ -226,3 +226,14 @@ func VerifyFFMpegPath(path string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Removes the directory and makes it again. Throws fatal error on failure.
|
||||
func CleanupDirectory(path string) {
|
||||
log.Traceln("Cleaning", path)
|
||||
if err := os.RemoveAll(path); err != nil {
|
||||
log.Fatalln("Unable to remove directory. Please check the ownership and permissions", err)
|
||||
}
|
||||
if err := os.MkdirAll(path, 0777); err != nil {
|
||||
log.Fatalln("Unable to create directory. Please check the ownership and permissions", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user