diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-08-08 12:15:13 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-08-08 12:15:13 +0100 |
commit | d25d3d59f8dd91b0e1353dbbb0bf04caa9717fe6 (patch) | |
tree | 9e31641699c7cb534f4c36c55ffadb66f75ddba6 | |
parent | 19a6b8aa175df24c3262b64f040a174fea1839e0 (diff) | |
download | rabbitmq-server-d25d3d59f8dd91b0e1353dbbb0bf04caa9717fe6.tar.gz |
refactor: less confusing variable names
-rw-r--r-- | src/rabbit_plugins.erl | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index c3d1ad7c..0320c69f 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -51,8 +51,8 @@ setup() -> {ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir), {ok, EnabledFile} = application:get_env(rabbit, enabled_plugins_file), prepare_plugins(EnabledFile, PluginDir, ExpandDir), - [prepare_dir_plugin(PluginName) || - PluginName <- filelib:wildcard(ExpandDir ++ "/*/ebin/*.app")]. + [prepare_dir_plugin(PluginAppDescPath) || + PluginAppDescPath <- filelib:wildcard(ExpandDir ++ "/*/ebin/*.app")]. %% @doc Lists the plugins which are currently running. active() -> @@ -137,15 +137,11 @@ prepare_plugins(EnabledFile, PluginsDistDir, ExpandDir) -> [prepare_plugin(Plugin, ExpandDir) || Plugin <- ToUnpackPlugins]. -prepare_dir_plugin(PluginAppDescFn) -> - %% Add the plugin ebin directory to the load path - PluginEBinDirN = filename:dirname(PluginAppDescFn), - code:add_path(PluginEBinDirN), - - %% We want the second-last token - NameTokens = string:tokens(PluginAppDescFn,"/."), - PluginNameString = lists:nth(length(NameTokens) - 1, NameTokens), - list_to_atom(PluginNameString). +prepare_dir_plugin(PluginAppDescPath) -> + PluginEBinDir = filename:dirname(PluginAppDescPath), + code:add_path(PluginEBinDir), + NameTokens = string:tokens(PluginAppDescPath, "/."), + list_to_atom(lists:nth(length(NameTokens) - 1, NameTokens)). %%---------------------------------------------------------------------------- |