From 72ec69e37d37c4bb20ed451a9d1b8e6c4b2a3164 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Mon, 6 Dec 2021 21:05:45 +0100 Subject: [PATCH] using payload relative path by default --- v2/pkg/protocols/common/generators/validate.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/v2/pkg/protocols/common/generators/validate.go b/v2/pkg/protocols/common/generators/validate.go index 5b9ca44a..7bdea4c8 100644 --- a/v2/pkg/protocols/common/generators/validate.go +++ b/v2/pkg/protocols/common/generators/validate.go @@ -28,21 +28,10 @@ func (g *PayloadGenerator) validate(payloads map[string]interface{}, templatePat changed := false - var dir string - if folderutil.IsWindowsOS() { - dir, payloadType = filepath.Split(filepath.Join(templatePath, payloadType)) - } else { - dir, _ = filepath.Split(templatePath) - } + dir, _ := filepath.Split(templatePath) + templatePathInfo, _ := folderutil.NewPathInfo(dir) + payloadPathsToProbe, _ := templatePathInfo.MeshWith(payloadType) - templatePathInfo, err := folderutil.NewPathInfo(dir) - if err != nil { - return err - } - payloadPathsToProbe, err := templatePathInfo.MeshWith(payloadType) - if err != nil { - return err - } for _, payloadPath := range payloadPathsToProbe { if fileExists(payloadPath) { payloads[name] = payloadPath