aboutsummaryrefslogtreecommitdiff
path: root/internal/conf/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/conf/utils.go')
-rw-r--r--internal/conf/utils.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/conf/utils.go b/internal/conf/utils.go
index ad716018..5da34f0c 100644
--- a/internal/conf/utils.go
+++ b/internal/conf/utils.go
@@ -5,6 +5,7 @@
package conf
import (
+ "path/filepath"
"strings"
"github.com/pkg/errors"
@@ -25,3 +26,11 @@ func openSSHVersion() (string, error) {
v = strings.TrimSuffix(strings.TrimPrefix(v, "OpenSSH_"), "p")
return v, nil
}
+
+// ensureAbs prepends the WorkDir to the given path if it is not an absolute path.
+func ensureAbs(path string) string {
+ if filepath.IsAbs(path) {
+ return path
+ }
+ return filepath.Join(WorkDir(), path)
+}