mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
simplify logic to expand included paths
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
@@ -51,16 +50,13 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if filepath.IsAbs(includedTask.Taskfile) {
|
path, err := execext.Expand(includedTask.Taskfile)
|
||||||
path = includedTask.Taskfile
|
if err != nil {
|
||||||
} else if strings.HasPrefix(includedTask.Taskfile, "~") {
|
return err
|
||||||
home, err := execext.Expand("~")
|
}
|
||||||
if err != nil {
|
|
||||||
return err
|
if ! filepath.IsAbs(path) {
|
||||||
}
|
path = filepath.Join(dir, path)
|
||||||
path = strings.Replace(includedTask.Taskfile, "~", home, 1)
|
|
||||||
} else {
|
|
||||||
path = filepath.Join(dir, includedTask.Taskfile)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info, err := os.Stat(path)
|
info, err := os.Stat(path)
|
||||||
|
Reference in New Issue
Block a user