plugin: Rewrite the logic of define_plugins_dir

Currently, there is a duplicate error duplication when
compiling the catalog. This is due to the fact that the
call to `define_plugins_dir` is called with the exact same
parameter `$install_path` hence causing the error.

By including the name of the plugin within the name of the resource
we ensure the resource name is unique during catalog compilation.
Merge pull request #254 from Mylezeem/duplicate_resources

plugin: Rewrite the logic of define_plugins_dir