diff --git a/main.go b/main.go index 768dc3f..9fbb531 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "strings" + "path/filepath" "github.com/bitrise-io/go-steputils/stepconf" "github.com/bitrise-io/go-steputils/tools" @@ -106,7 +107,8 @@ func main() { } if build.Status != 0 { - if strings.TrimSpace(cfg.BuildArtifactsSavePath) != "" { + buildArtifactSaveDir := strings.TrimSpace(cfg.BuildArtifactsSavePath) + if buildArtifactSaveDir != "" { artifactsResponse, err := build.GetBuildArtifacts(app) if err != nil { log.Warnf("failed to get build artifacts, error: %s", err) @@ -116,12 +118,12 @@ func main() { if err != nil { log.Warnf("failed to get build artifact, error: %s", err) } - - downloadErr := artifactObj.Artifact.DownloadArtifact(strings.TrimSpace(cfg.BuildArtifactsSavePath) + artifactObj.Artifact.Title) + fullBuildArtifactsSavePath := filepath.Join(buildArtifactSaveDir, artifactObj.Artifact.Title) + downloadErr := artifactObj.Artifact.DownloadArtifact(fullBuildArtifactsSavePath) if downloadErr != nil { log.Warnf("failed to download artifact, error: %s", downloadErr) } - log.Donef("Downloaded: " + artifactObj.Artifact.Title + " to path " + strings.TrimSpace(cfg.BuildArtifactsSavePath)) + log.Donef("Downloaded: " + artifactObj.Artifact.Title + " to path " + fullBuildArtifactsSavePath) } } }