2022-08-31 22:41:05 -04:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
2022-09-01 15:16:56 -04:00
|
|
|
"os/exec"
|
2022-08-31 22:41:05 -04:00
|
|
|
"path"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func FilenameWithoutExtension(filename string) string {
|
|
|
|
return strings.TrimSuffix(filename, path.Ext(filename))
|
|
|
|
}
|
2022-09-01 15:16:56 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|