This Commented CUE demonstrates how to use the built-in function path.Join to construct well-formed paths from their individual string components.

file.cue
package example

import "path"

join: path.Join(["foo", "bar", "baz"], path.Unix)

unix:    path.Join(_components, path.Unix)
windows: path.Join(_components, path.Windows)

_components: [
	"foo",
	"bar",
	"baz",
	"..",
	"quux",
]
TERMINAL
$ cue export
{
    "join": "foo/bar/baz",
    "unix": "foo/bar/quux",
    "windows": "foo\\bar\\quux"
}
  • The path built-in package