webhookd/pkg/tools/script_resolver.go
2018-07-24 15:36:19 +00:00

19 lines
349 B
Go

package tools
import (
"errors"
"fmt"
"os"
"path"
)
// ResolveScript is resolving the target script.
func ResolveScript(dir, name string) (string, error) {
script := path.Join(dir, fmt.Sprintf("%s.sh", name))
if _, err := os.Stat(script); os.IsNotExist(err) {
return "", errors.New("Script not found: " + script)
}
return script, nil
}