adept/util/file.go
Gregory Ballantine 24f9b2b779
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added a quick and dirty file open check
2022-09-01 15:16:56 -04:00

23 lines
384 B
Go

package util
import (
"os/exec"
"path"
"strings"
)
func FilenameWithoutExtension(filename string) string {
return strings.TrimSuffix(filename, path.Ext(filename))
}
func IsFileLocked(filepath string) bool {
cmd := exec.Command("/usr/bin/lsof", filepath)
stdout, _ := cmd.Output()
if strings.Contains(string(stdout), filepath) {
return true
}
return false
}