We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69976cf commit 4f847e5Copy full SHA for 4f847e5
newt/newtutil/newtutil.go
@@ -22,6 +22,7 @@ package newtutil
22
import (
23
"fmt"
24
"io/ioutil"
25
+ "path/filepath"
26
"strconv"
27
"strings"
28
@@ -178,12 +179,17 @@ func MakeTempRepoDir() (string, error) {
178
179
}
180
181
func ProjRelPath(path string) string {
- if strings.HasPrefix(path, "/") {
182
- return path
+ if filepath.IsAbs(path) {
183
+ proj := interfaces.GetProject()
184
+ if proj != nil {
185
+ relPath, err := filepath.Rel(proj.Path(), path)
186
+ if err == nil {
187
+ path = relPath
188
+ }
189
190
191
- proj := interfaces.GetProject()
- return strings.TrimPrefix(path, proj.Path()+"/")
192
+ return path
193
194
195
func PrintNewtVersion() {
0 commit comments