Skip to content

Commit

Permalink
Update internal/compiler/compiler.go
Browse files Browse the repository at this point in the history
Co-authored-by: Pete Davison <[email protected]>
  • Loading branch information
vmaerten and pd93 authored Dec 30, 2024
1 parent da30452 commit e60fa47
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ func (c *Compiler) getSpecialVars(t *ast.Task, call *ast.Call) (map[string]strin
"TASK_VERSION": version.GetVersion(),
}
if t != nil {
TaskDir := t.Dir
if !filepath.IsAbs(t.Dir) {
TaskDir = filepathext.SmartJoin(c.Dir, t.Dir)
}
maps.Copy(allVars, map[string]string{"TASK": t.Task, "TASKFILE": t.Location.Taskfile, "TASKFILE_DIR": filepath.Dir(t.Location.Taskfile), "TASK_DIR": TaskDir})
if t != nil {
allVars["TASK"] = t.Task
allVars["TASK_DIR"] = filepathext.SmartJoin(c.Dir, t.Dir)
allVars["TASKFILE"] = t.Location.Taskfile
allVars["TASKFILE_DIR"] = filepath.Dir(t.Location.Taskfile)
}
if call != nil {
maps.Copy(allVars, map[string]string{"ALIAS": call.Task})
allVars["ALIAS"] = call.Task
}
}
return allVars, nil
}

0 comments on commit e60fa47

Please sign in to comment.