From 49fcbf19fa2a179d06990443349575ffa86a697f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 13 May 2002 16:11:19 +0200 Subject: Made the config directory available to plugins --- PLUGINS.html | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'PLUGINS.html') diff --git a/PLUGINS.html b/PLUGINS.html index de1a2ae9..5098ace6 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -513,7 +513,7 @@ the plugin should launch a separate thread to do this. -

Setup parameters

+

Setup parameters

Remember me...

@@ -648,6 +648,63 @@ your setup parameters and use that one to copy all parameters with one single st (like VDR does with its cSetup class). +
  +

Configuration files

+ +
I want my own stuff!

+ +There may be situations where a plugin requires configuration files of its own, maybe +for data that can't be stored in the simple setup parameters +of VDR, or maybe because it needs to launch other programs that simply need a separate +configuration file. While the plugin is free to store such files anywhere it +sees fit, it might be a good idea to put them in a common place, preferably +where other configuration data already exists. VDR provides the function + +


+const char *ConfigDirectory(const char *PluginName = NULL); +

+ +which returns a string containing the directory that VDR uses for its own configuration +files (defined through the -c option in the call to VDR), extended by +"/plugins". So assuming the VDR configuration directory is /video +(the default if no -c or -v option is given), +a call to ConfigDirectory() will return /video/plugins. The first +call to ConfigDirectory() will automatically make sure that the plugins +subdirectory will exist. If, for some reason, this cannot be achieved, NULL +will be returned. +

+The additional plugins directory is used to keep files from plugins apart +from those of VDR itself, making sure there will be no name clashes. If a plugin +needs only one extra configuration file, it is suggested that this file be named +name.conf, where name shall be the name of the plugin. +

+If a plugin needs more than one such file, it is suggested that the plugin stores +these in a subdirectory of its own, named after the plugin. To easily get such a name +the ConfigDirectory() function can be given an additional string that will +be appended to the returned directory name, as in + +


+const char *MyConfigDir = ConfigDirectory(Name()); +

+ +where Name() is the member function of the plugin class that returns the +plugin's name. Again, VDR will make sure that the requested directory will exist +(or return NULL in case of an error). +

+ +The returned string is statically allocated and will be overwritten by subsequent +calls to ConfigDirectory()! + +

+The ConfigDirectory() function is a static member function of the cPlugin +class. This allows it to be called even from outside any member function of the derived +plugin class, by writing + +


+const char *MyConfigDir = cPlugin::ConfigDirectory(); +

+

+


Internationalization

Welcome to Babylon!

-- cgit v1.2.3