From e51037ff4bbb32017299fd27aec24456d5fe1a9b Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 4 Sep 2024 11:45:27 +0200 Subject: [PATCH] fixes --- libs/template/materialize.go | 7 ------- libs/template/renderer.go | 9 +++++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/libs/template/materialize.go b/libs/template/materialize.go index bc7da770b..d824bf381 100644 --- a/libs/template/materialize.go +++ b/libs/template/materialize.go @@ -40,13 +40,6 @@ func Materialize(ctx context.Context, configFilePath, templateRoot, outputDir st return err } - if outputDir == "" { - outputDir, err = os.Getwd() - if err != nil { - return err - } - } - templatePath := filepath.Join(templateRoot, templateDirName) libraryPath := filepath.Join(templateRoot, libraryDirName) schemaPath := filepath.Join(templateRoot, schemaFileName) diff --git a/libs/template/renderer.go b/libs/template/renderer.go index 3739fc6b6..fc4a4d895 100644 --- a/libs/template/renderer.go +++ b/libs/template/renderer.go @@ -153,12 +153,17 @@ func (r *renderer) computeFile(relPathTemplate string) (file, error) { return nil, err } + rootPath, err := filepath.Abs(r.instanceRoot) + if err != nil { + return nil, err + } + // If file name does not specify the `.tmpl` extension, then it is copied // over as is, without treating it as a template if !strings.HasSuffix(relPathTemplate, templateExtension) { return ©File{ dstPath: &destinationPath{ - root: r.instanceRoot, + root: rootPath, relPath: relPath, }, perm: perm, @@ -196,7 +201,7 @@ func (r *renderer) computeFile(relPathTemplate string) (file, error) { return &inMemoryFile{ ctx: r.ctx, dstPath: &destinationPath{ - root: r.instanceRoot, + root: rootPath, relPath: relPath, }, perm: perm,