From 4230ddb633eb0a098c3e3a5b92a308e3913ef9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Costas=20S=C3=A1nchez?= Date: Mon, 5 Oct 2020 18:58:30 +0200 Subject: [PATCH] Patch `rebar_base_compiler` to handle extensions with no leading dot --- src/rebar_base_compiler.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl index ad81c86c..56d8b550 100644 --- a/src/rebar_base_compiler.erl +++ b/src/rebar_base_compiler.erl @@ -96,9 +96,17 @@ run(Config, FirstFiles, SourceDir, SourceExt, TargetDir, TargetExt, TargetDir :: file:filename(), SourceExt :: string(), TargetExt :: string(). -run(Config, FirstFiles, SourceDir, SourceExt, TargetDir, TargetExt, +run(Config, FirstFiles, SourceDir, SourceExt0, TargetDir, TargetExt, Compile3Fn, Opts) -> - %% Convert simple extension to proper regex + %% Convert simple extension to proper regex. + %% If the extension has a leading dot (e.g.: `.peg') + %% we escape it. + %% Otherwise, if the extension doesn't have a leading dot + %% we add it ourselves (e.g.: `peg' -> `.peg') + SourceExt = case SourceExt0 of + [$.|_Ext] -> SourceExt0; + _ -> [$.] ++ SourceExt0 + end, SourceExtRe = "^(?!\\._).*\\" ++ SourceExt ++ [$$], Recursive = proplists:get_value(recursive, Opts, true),