diff --git a/src/bpmlib/compilation.go b/src/bpmlib/compilation.go index cc71a31..6617b21 100644 --- a/src/bpmlib/compilation.go +++ b/src/bpmlib/compilation.go @@ -438,6 +438,10 @@ func downloadPackageFiles(pkgInfo *PackageInfo, tempDirectory string, verbose bo if err != nil { return err } + filepath, err := envsubst.Eval(strings.TrimSpace(download.Filepath), replaceVars) + if err != nil { + return err + } extractTo, err := envsubst.Eval(strings.TrimSpace(download.ExtractTo), replaceVars) if err != nil { return err @@ -458,9 +462,11 @@ func downloadPackageFiles(pkgInfo *PackageInfo, tempDirectory string, verbose bo switch download.Type { case "", "file": - filepath := path.Join(tempDirectory, path.Base(downloadUrl)) - if download.Filepath != "" && download.Filepath[0] != '/' { - filepath = path.Join(tempDirectory, download.Filepath) + if filepath == "" { + filepath = path.Join(tempDirectory, path.Base(downloadUrl)) + } + if filepath[0] != '/' { + filepath = path.Join(tempDirectory, filepath) } err := downloadFile("Downloading file "+path.Base(filepath), downloadUrl, filepath, 0644) diff --git a/src/bpmlib/packages.go b/src/bpmlib/packages.go index 654d801..48ccf42 100644 --- a/src/bpmlib/packages.go +++ b/src/bpmlib/packages.go @@ -51,7 +51,7 @@ type PackageInfo struct { type PackageDownload struct { Url string `yaml:"url"` Type string `yaml:"type,omitempty"` - Filepath string `yaml:"filepath,omitempty,omitempty"` + Filepath string `yaml:"filepath,omitempty"` // Archive options NoExtract bool `yaml:"no_extract,omitempty"`