engine: Make paths relative to the CUE file they're defined in
Fixes #1309 Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
committed by
Sam Alba
parent
ec69734c51
commit
9c81a155c9
11
plan/plan.go
11
plan/plan.go
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -97,16 +96,12 @@ func (p *Plan) registerLocalDirs() error {
|
||||
}
|
||||
|
||||
for _, v := range imports {
|
||||
dir, err := v.Value.Lookup("path").String()
|
||||
dir, err := v.Value.Lookup("path").AbsPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
abs, err := filepath.Abs(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(abs); errors.Is(err, os.ErrNotExist) {
|
||||
return fmt.Errorf("path %q does not exist", abs)
|
||||
if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) {
|
||||
return fmt.Errorf("path %q does not exist", dir)
|
||||
}
|
||||
p.context.LocalDirs.Add(dir)
|
||||
}
|
||||
|
Reference in New Issue
Block a user