summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-01-25 15:52:53 +0100
committerlouis <louis.braun@gmx.de>2014-01-25 15:52:53 +0100
commit2a3eecd99e9d7d8a138543ebdb892347f68aeaa2 (patch)
tree446c81af4061046903e329fcf704c2eb7bf32252 /config.c
parent0cbc226651dbce5c01167ba24edc1d417634fb39 (diff)
downloadvdr-plugin-tvguide-2a3eecd99e9d7d8a138543ebdb892347f68aeaa2.tar.gz
vdr-plugin-tvguide-2a3eecd99e9d7d8a138543ebdb892347f68aeaa2.tar.bz2
also check default paths when images and icons are loaded
Diffstat (limited to 'config.c')
-rw-r--r--config.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/config.c b/config.c
index 243368c..313dda2 100644
--- a/config.c
+++ b/config.c
@@ -191,38 +191,47 @@ void cTvguideConfig::SetStyle(void) {
}
void cTvguideConfig::SetLogoPath(cString path) {
- logoPath = path;
+ logoPath = checkSlashAtEnd(*path);
logoPathSet = true;
esyslog("tvguide: Logo Path set to %s", *logoPath);
}
void cTvguideConfig::SetImagesPath(cString path) {
- epgImagePath = path;
+ epgImagePath = checkSlashAtEnd(*path);
imagesPathSet = true;
esyslog("tvguide: EPG Image Path set to %s", *epgImagePath);
}
void cTvguideConfig::SetIconsPath(cString path) {
- iconPath = path;
+ iconPath = checkSlashAtEnd(*path);
iconsPathSet = true;
esyslog("tvguide: Icon Path set to %s", *iconPath);
}
void cTvguideConfig::SetDefaultPathes(void) {
+ logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
+ iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
+ epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
+
if (!logoPathSet) {
- cString path = cString::sprintf("%s/channellogos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
- SetLogoPath(path);
+ logoPath = logoPathDefault;
}
if (!imagesPathSet) {
- cString path = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
- SetImagesPath(path);
+ epgImagePath = epgImagePathDefault;
}
if (!iconsPathSet) {
- cString path = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
- SetIconsPath(path);
+ iconPath = iconPathDefault;
}
}
+cString cTvguideConfig::checkSlashAtEnd(std::string path) {
+ try {
+ if (!(path.at(path.size()-1) == '/'))
+ return cString::sprintf("%s/", path.c_str());
+ } catch (...) {return path.c_str();}
+ return path.c_str();
+}
+
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value);