Archived
1
0

Adds helper to generate absolute paths

This commit is contained in:
Jip J. Dekker 2016-03-19 20:44:13 +01:00
parent 9d3ebaf846
commit 4cc5b785a3

View File

@ -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)
}