Project restructure (#18)
* First pass at restructuring the project; untested but it does compile * Restructure builds and runs 🎉 * Add the dist folder to the gitignore * Update core/playlist/monitor.go * golint and reorganize the monitor.go file Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
32
core/ffmpeg/verifyInstall.go
Normal file
32
core/ffmpeg/verifyInstall.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package ffmpeg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
//VerifyFFMpegPath verifies that the path exists, is a file, and is executable
|
||||
func VerifyFFMpegPath(path string) error {
|
||||
stat, err := os.Stat(path)
|
||||
|
||||
if os.IsNotExist(err) {
|
||||
return errors.New("ffmpeg path does not exist")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("error while verifying the ffmpeg path: %s", err.Error())
|
||||
}
|
||||
|
||||
if stat.IsDir() {
|
||||
return errors.New("ffmpeg path can not be a folder")
|
||||
}
|
||||
|
||||
mode := stat.Mode()
|
||||
//source: https://stackoverflow.com/a/60128480
|
||||
if mode&0111 == 0 {
|
||||
return errors.New("ffmpeg path is not executable")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user