]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commit
core: sets plugin_path to loaded plugins
authorMatthias Hecker <mail@apoc.cc>
Thu, 16 Apr 2020 21:48:42 +0000 (23:48 +0200)
committerMatthias Hecker <mail@apoc.cc>
Thu, 16 Apr 2020 21:48:42 +0000 (23:48 +0200)
commit7bee70f012b85c03f73fa3e765417a939e02a5cf
tree64385c8d40a47a60f9ca3365cf92248f2fc8c6bc
parentff6d7e5d043da99b2da36f628d52b7b5df47119d
core: sets plugin_path to loaded plugins

While loading a plugin in the manager using #load_botmodule_file this
will remember the directory of the file that is being loaded in
@next_plugin_path. In the plugin/BotModule initialization we set the
path in plugin_path of the plugin.

This was the only solution I could find to get this information in the
plugin. It is useful because this allows the plugin to know in which
directory it is located, it can then easily access data files stored
alongside the plugin.

Some built-in plugins (see #42) use the data/rbot/templates to copy
data files on bot load (see #repopulate_botclass_directory) into the
profile directory (~/.rbot/).
lib/rbot/plugins.rb