Skip to content

Commit

Permalink
Handle dependencies with absolute paths
Browse files Browse the repository at this point in the history
Fixes #22
  • Loading branch information
ejholmes committed Sep 21, 2017
1 parent 75b278e commit ee548bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,14 @@ func (t *target) Dependencies(ctx context.Context) ([]string, error) {
if path == "" {
continue
}

// If the path is not already and absolute path, make it one.
if !filepath.IsAbs(path) {
path = filepath.Join(t.dir, path)
}

// Make all paths relative to the working directory.
path, err := filepath.Rel(t.wd, filepath.Join(t.dir, scanner.Text()))
path, err := filepath.Rel(t.wd, path)
if err != nil {
return deps, err
}
Expand Down
3 changes: 2 additions & 1 deletion test/110-compile/Walkfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ case $target in
all)
case $phase in
deps)
echo hello
# Absolute paths work too.
echo $PWD/hello
echo test
;;
esac ;;
Expand Down

0 comments on commit ee548bf

Please sign in to comment.