File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -344,13 +344,18 @@ impl Run {
344
344
let template_parser = Self :: template_parser ( ) ;
345
345
let contents = paths
346
346
. iter ( )
347
- . map ( std:: fs:: read)
348
- . map ( |c| {
349
- c. map_err ( |e| e. into ( ) )
350
- . and_then ( |cc| TemplateContent :: infer_from_bytes ( cc, & template_parser) )
351
- } )
347
+ . map ( |path| TemplateContent :: infer_from_bytes ( std:: fs:: read ( path) ?, & template_parser) )
352
348
. collect :: < Result < Vec < _ > , _ > > ( ) ?;
353
- let pairs = paths. into_iter ( ) . zip ( contents) . collect ( ) ;
349
+ // Strip optional .tmpl extension
350
+ // Templates can use this if they don't want to store files with their final extensions
351
+ let paths = paths. into_iter ( ) . map ( |p| {
352
+ if p. extension ( ) . map ( |e| e == "tmpl" ) . unwrap_or_default ( ) {
353
+ p. with_extension ( "" )
354
+ } else {
355
+ p
356
+ }
357
+ } ) ;
358
+ let pairs = paths. zip ( contents) . collect ( ) ;
354
359
Ok ( pairs)
355
360
}
356
361
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments