From 15896a2318748000009d7f5c741c3f818a39df91 Mon Sep 17 00:00:00 2001 From: radrow Date: Mon, 23 Mar 2020 16:50:47 +0100 Subject: [PATCH] Fix including by path --- src/aeso_parser.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/aeso_parser.erl b/src/aeso_parser.erl index 74a329c..16212ce 100644 --- a/src/aeso_parser.erl +++ b/src/aeso_parser.erl @@ -656,8 +656,14 @@ stdlib_options() -> get_include_code(File, Ann, Opts) -> case {read_file(File, Opts), read_file(File, stdlib_options())} of - {{ok, _}, {ok,_ }} -> - fail(ann_pos(Ann), "Illegal redefinition of standard library " ++ File); + {{ok, Bin}, {ok, _}} -> + case filename:basename(File) == File of + true -> { error + , fail( ann_pos(Ann) + , "Illegal redefinition of standard library " ++ binary_to_list(File))}; + %% If a path is provided then the stdlib takes lower priority + false -> {ok, binary_to_list(Bin)} + end; {_, {ok, Bin}} -> {ok, binary_to_list(Bin)}; {{ok, Bin}, _} ->