Skip to content

Commit 47fd55f

Browse files
ferranbtcanercidam
andauthored
Use always absolute output path (#344)
Fixes #343 --------- Co-authored-by: Caner Çıdam <canercidam01@gmail.com>
1 parent 7e2ffd3 commit 47fd55f

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

playground/artifacts.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ func NewOutput(dst string) (*output, error) {
527527
// Use the $HOMEDIR/devnet as the default output
528528
dst = filepath.Join(playgroundDir, "devnet")
529529
}
530+
dst, err = filepath.Abs(dst)
531+
if err != nil {
532+
return nil, fmt.Errorf("failed to convert path %s to absolute: %w", dst, err)
533+
}
530534

531535
out := &output{dst: dst, homeDir: playgroundDir}
532536

@@ -552,10 +556,6 @@ func (o *output) Read(path string) (string, error) {
552556
return string(data), nil
553557
}
554558

555-
func (o *output) AbsoluteDstPath() (string, error) {
556-
return filepath.Abs(o.dst)
557-
}
558-
559559
func (o *output) Exists(path string) bool {
560560
_, err := os.Stat(filepath.Join(o.dst))
561561
return err == nil

playground/components_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"github.com/ethereum/go-ethereum/common"
2020
"github.com/ethereum/go-ethereum/ethclient"
2121
"github.com/ethereum/go-ethereum/rpc"
22-
"github.com/flashbots/builder-playground/utils"
2322
"github.com/stretchr/testify/require"
2423
)
2524

@@ -224,14 +223,9 @@ func (tt *testFramework) test(component ComponentGen, args []string) *Manifest {
224223
t.Fatal(err)
225224
}
226225

227-
homeDir, err := utils.GetPlaygroundDir()
226+
o, err := NewOutput(e2eTestDir)
228227
require.NoError(t, err)
229228

230-
o := &output{
231-
dst: e2eTestDir,
232-
homeDir: homeDir,
233-
}
234-
235229
exCtx := &ExContext{
236230
Output: o,
237231
LogLevel: LevelDebug,

playground/local_runner.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,7 @@ func (d *LocalRunner) toDockerComposeService(s *Service) (map[string]interface{}
580580

581581
// The containers have access to the full set of artifacts on the /artifacts folder
582582
// so, we have to bind it as a volume on the container.
583-
outputFolder, err := d.out.AbsoluteDstPath()
584-
if err != nil {
585-
return nil, nil, fmt.Errorf("failed to get absolute path for output folder: %w", err)
586-
}
583+
outputFolder := d.out.Dst()
587584

588585
// Validate that the image exists
589586
imageName := fmt.Sprintf("%s:%s", s.Image, s.Tag)

0 commit comments

Comments
 (0)