From 4cc5b785a32238a6db2712cc7b1ae273cfa3c908 Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Sat, 19 Mar 2016 20:44:13 +0100 Subject: [PATCH] Adds helper to generate absolute paths --- helpers/file_utils.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/helpers/file_utils.go b/helpers/file_utils.go index fe67ba6..1286350 100644 --- a/helpers/file_utils.go +++ b/helpers/file_utils.go @@ -70,3 +70,12 @@ func FindFileDir(file string) (string, error) { Err: errors.New("directory containing " + file + " not found"), } } + +// AbsolutePath returns an the path if it is absolute or +// otherwise filepath.Join(lib, path) +func AbsolutePath(path, lib string) string { + if filepath.IsAbs(path) { + return path + } + return filepath.Join(lib, path) +}