diff options
author | Paul Jones <pauljones23@gmail.com> | 2009-07-24 21:24:26 +0100 |
---|---|---|
committer | Paul Jones <pauljones23@gmail.com> | 2009-07-24 21:24:26 +0100 |
commit | dea4af444b855c1eb0fe521853893f52cefb5d53 (patch) | |
tree | 2dd0f444350b30b28712f9c029dcc875666eb995 | |
parent | a23790a0c34fa2d5e1c9cbab892a6888ba550f63 (diff) | |
download | rabbitmq-server-dea4af444b855c1eb0fe521853893f52cefb5d53.tar.gz |
Fixed handling of symlinks; compacted list comprehensions
-rw-r--r-- | src/rabbit_plugin_activator.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/rabbit_plugin_activator.erl b/src/rabbit_plugin_activator.erl index a7311882..2769d3c4 100644 --- a/src/rabbit_plugin_activator.erl +++ b/src/rabbit_plugin_activator.erl @@ -131,14 +131,23 @@ delete_dir(Dir) -> true -> case file:list_dir(Dir) of {ok, Files} -> - Paths = [Dir ++ "/" ++ F || F <- Files], - [delete_dir(F) || F <- Paths, filelib:is_dir(F)], - [file:delete(F) || F <- Paths, filelib:is_file(F)] + [case Dir ++ "/" ++ F of + Fn -> + case filelib:is_dir(Fn) and not(is_symlink(Fn)) of + true -> delete_dir(Fn); + false -> file:delete(Fn) + end + end || F <- Files] end, ok = file:del_dir(Dir); false -> ok end. +is_symlink(Name) -> + case file:read_link(Name) of + {ok, _} -> true; + _ -> false + end. unpack_ez_plugins(PluginSrcDir, PluginDestDir) -> %% Eliminate the contents of the destination directory |