pulumi/pkg/tools/lumidl/paths.go
joeduffy 35aa6b7559 Rename pulumi/lumi to pulumi/pulumi-fabric
We are renaming Lumi to Pulumi Fabric.  This change simply renames the
pulumi/lumi repo to pulumi/pulumi-fabric, without the CLI tools and other
changes that will follow soon afterwards.
2017-08-02 09:25:22 -07:00

20 lines
559 B
Go

// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
package lumidl
import (
"path/filepath"
"golang.org/x/tools/go/loader"
"github.com/pulumi/pulumi-fabric/pkg/util/contract"
)
// RelFilename gets the target filename for any given position relative to the root.
func RelFilename(root string, prog *loader.Program, p goPos) string {
pos := p.Pos()
source := prog.Fset.Position(pos).Filename // the source filename.`
rel, err := filepath.Rel(root, source) // make it relative to the root.
contract.Assert(err == nil)
return rel
}