diff options
author | Tim Watson <watson.timothy@gmail.com> | 2014-02-10 20:24:19 +0000 |
---|---|---|
committer | Tim Watson <watson.timothy@gmail.com> | 2014-02-10 20:24:19 +0000 |
commit | 599fd29739378fe09b80317221daec709a0e5aea (patch) | |
tree | 0c8da7af4aaf0ec867b97a42a05f7b61d3bcee2c | |
parent | 0227ce45c15cc7f40197fd0b824a36094db5dc89 (diff) | |
download | rabbitmq-server-599fd29739378fe09b80317221daec709a0e5aea.tar.gz |
rabbit_file:wildcard/2 should return [] if the dir is non-existing
-rw-r--r-- | src/rabbit_file.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rabbit_file.erl b/src/rabbit_file.erl index 1a766b05..4658ecfd 100644 --- a/src/rabbit_file.erl +++ b/src/rabbit_file.erl @@ -94,9 +94,12 @@ ensure_dir_internal(File) -> end. wildcard(Pattern, Dir) -> - {ok, Files} = list_dir(Dir), - {ok, RE} = re:compile(Pattern, [anchored]), - [File || File <- Files, match =:= re:run(File, RE, [{capture, none}])]. + case list_dir(Dir) of + {ok, Files} -> {ok, RE} = re:compile(Pattern, [anchored]), + [File || File <- Files, + match =:= re:run(File, RE, [{capture, none}])]; + {error, _} -> [] + end. list_dir(Dir) -> with_fhc_handle(fun () -> prim_file:list_dir(Dir) end). |