Skip to content

Commit

Permalink
Merge pull request #639 from paketo-buildpacks/tempdir
Browse files Browse the repository at this point in the history
Create tempdir if not using the default
  • Loading branch information
Daniel Mikusa authored Apr 14, 2022
2 parents 3885ddb + e1c1626 commit b6a811c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drafts/drafts.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,14 @@ func (r RegistryBuildpackLoader) LoadBuildpacks(uris []string) ([]Buildpack, err
}

func (r RegistryBuildpackLoader) LoadBuildpack(uri string) (Buildpack, error) {
tarFile, err := ioutil.TempFile(os.Getenv("RUNNER_TEMP"), "tarfiles")
tmpdir := os.Getenv("RUNNER_TEMP")
if tmpdir != "" {
if err := os.MkdirAll(tmpdir, 0755); err != nil {
return Buildpack{}, fmt.Errorf("unable to create tempdir\n%w", err)
}
}

tarFile, err := ioutil.TempFile(tmpdir, "tarfiles")
if err != nil {
return Buildpack{}, fmt.Errorf("unable to create tempfile\n%w", err)
}
Expand Down

0 comments on commit b6a811c

Please sign in to comment.