Skip to content

Commit

Permalink
using fs.Exists method from packit to reasonate about file existance …
Browse files Browse the repository at this point in the history
…of extension.toml
  • Loading branch information
pacostas authored and ForestEckhardt committed Jun 7, 2023
1 parent 2a7d0ca commit 357059a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packagers/jam.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package packagers

import (
"fmt"
"os"
"path/filepath"

"github.com/paketo-buildpacks/packit/v2/fs"
"github.com/paketo-buildpacks/packit/v2/pexec"
)

Expand Down Expand Up @@ -38,13 +38,12 @@ func (j Jam) Execute(buildpackDir, output, version string, offline bool) error {

buildpackOrExtensionToml := "buildpack.toml"
command := "--buildpack"
if _, err := os.Stat(extensionTomlPath); err == nil {

if fileExists, err := fs.Exists(extensionTomlPath); fileExists == true && err == nil {
buildpackOrExtensionToml = "extension.toml"
command = "--extension"
}

fmt.Println("jam", command, filepath.Join(buildpackDir, buildpackOrExtensionToml), "--output", output, "--version", version, "--offline", offline)

args := []string{
"pack",
command, filepath.Join(buildpackDir, buildpackOrExtensionToml),
Expand Down

0 comments on commit 357059a

Please sign in to comment.