summaryrefslogtreecommitdiff
path: root/plugin.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-09-01 14:03:45 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2012-09-01 14:03:45 +0200
commit13edfc13820efc784c08b7b93e73f34a73c1e80e (patch)
tree02d030f96fa1f851454f75d84f03cd323f20105d /plugin.c
parentd3b3c43e8f0f584fc679787edc8799399f8e8d3e (diff)
downloadvdr-13edfc13820efc784c08b7b93e73f34a73c1e80e.tar.gz
vdr-13edfc13820efc784c08b7b93e73f34a73c1e80e.tar.bz2
Implemented FHS support; fixed handling config directory if only -v is given
Diffstat (limited to 'plugin.c')
-rw-r--r--plugin.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/plugin.c b/plugin.c
index 52256ee0..db16d080 100644
--- a/plugin.c
+++ b/plugin.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: plugin.c 2.3 2012/03/11 13:56:02 kls Exp $
+ * $Id: plugin.c 2.4 2012/09/01 13:10:27 kls Exp $
*/
#include "plugin.h"
@@ -25,7 +25,9 @@
// --- cPlugin ---------------------------------------------------------------
-char *cPlugin::configDirectory = NULL;
+cString cPlugin::configDirectory;
+cString cPlugin::cacheDirectory;
+cString cPlugin::resourceDirectory;
cPlugin::cPlugin(void)
{
@@ -132,8 +134,7 @@ cString cPlugin::SVDRPCommand(const char *Command, const char *Option, int &Repl
void cPlugin::SetConfigDirectory(const char *Dir)
{
- free(configDirectory);
- configDirectory = strdup(Dir);
+ configDirectory = Dir;
}
const char *cPlugin::ConfigDirectory(const char *PluginName)
@@ -141,7 +142,35 @@ const char *cPlugin::ConfigDirectory(const char *PluginName)
static cString buffer;
if (!cThread::IsMainThread())
esyslog("ERROR: plugin '%s' called cPlugin::ConfigDirectory(), which is not thread safe!", PluginName ? PluginName : "<no name given>");
- buffer = cString::sprintf("%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
+ buffer = cString::sprintf("%s/plugins%s%s", *configDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
+ return MakeDirs(buffer, true) ? *buffer : NULL;
+}
+
+void cPlugin::SetCacheDirectory(const char *Dir)
+{
+ cacheDirectory = Dir;
+}
+
+const char *cPlugin::CacheDirectory(const char *PluginName)
+{
+ static cString buffer;
+ if (!cThread::IsMainThread())
+ esyslog("ERROR: plugin '%s' called cPlugin::CacheDirectory(), which is not thread safe!", PluginName ? PluginName : "<no name given>");
+ buffer = cString::sprintf("%s/plugins%s%s", *cacheDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
+ return MakeDirs(buffer, true) ? *buffer : NULL;
+}
+
+void cPlugin::SetResourceDirectory(const char *Dir)
+{
+ resourceDirectory = Dir;
+}
+
+const char *cPlugin::ResourceDirectory(const char *PluginName)
+{
+ static cString buffer;
+ if (!cThread::IsMainThread())
+ esyslog("ERROR: plugin '%s' called cPlugin::ResourceDirectory(), which is not thread safe!", PluginName ? PluginName : "<no name given>");
+ buffer = cString::sprintf("%s/plugins%s%s", *resourceDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
return MakeDirs(buffer, true) ? *buffer : NULL;
}