1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

Refactor: Add SmartJoin to handle IsAbs automatically

This commit is contained in:
Andrey Nering
2022-08-06 18:19:07 -03:00
parent c20842e7cd
commit c4e10ef0aa
12 changed files with 76 additions and 71 deletions

View File

@@ -1,10 +1,10 @@
package task
import (
"path/filepath"
"strings"
"github.com/go-task/task/v3/internal/execext"
"github.com/go-task/task/v3/internal/filepathext"
"github.com/go-task/task/v3/internal/status"
"github.com/go-task/task/v3/internal/templater"
"github.com/go-task/task/v3/taskfile"
@@ -68,8 +68,8 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
if err != nil {
return nil, err
}
if e.Dir != "" && !filepath.IsAbs(new.Dir) {
new.Dir = filepath.Join(e.Dir, new.Dir)
if e.Dir != "" {
new.Dir = filepathext.SmartJoin(e.Dir, new.Dir)
}
if new.Prefix == "" {
new.Prefix = new.Task