This commit is contained in:
Fabian Jakobs 2024-09-04 11:45:27 +02:00
parent 90d6490106
commit e51037ff4b
No known key found for this signature in database
2 changed files with 7 additions and 9 deletions

View File

@ -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)

View File

@ -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 &copyFile{
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,