Skip to content

Commit

Permalink
fix exec.LookPath() to find ffmpeg in current folder.
Browse files Browse the repository at this point in the history
the fix committced in v0.6.6 is incorrect.
  • Loading branch information
kira1928 committed Jan 5, 2023
1 parent a41d34d commit f5523d5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ package utils
import (
"crypto/md5"
"encoding/hex"
"errors"
"math/rand"
"net/url"
"os"
"os/exec"
"regexp"
)

func IsFFmpegExist() bool {
_, err := exec.LookPath("ffmpeg")
if err != nil {
// exec.LookPath no longer searches current directory since golang 1.19,
// so we check the current directory separately
_, err = os.Stat("ffmpeg")
if errors.Is(err, exec.ErrDot) {
// put ffmpeg.exe and binary like bililive-windows-amd64.exe to the same folder is allowed
err = nil
}
return err == nil
}
Expand Down

0 comments on commit f5523d5

Please sign in to comment.