summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-04-10 17:15:16 +0200
committerlouis <louis.braun@gmx.de>2013-04-10 17:15:16 +0200
commit553d67045ed05184f98ee707b2b1fd2d38f45f60 (patch)
tree71c3bbb095142956815dc90406698f1e08c6a7bb
parente269a87fc24964fbaac485d6a60f3c331ed321a6 (diff)
downloadskin-nopacity-553d67045ed05184f98ee707b2b1fd2d38f45f60.tar.gz
skin-nopacity-553d67045ed05184f98ee707b2b1fd2d38f45f60.tar.bz2
check for Slash at end of startup path parameters
-rw-r--r--HISTORY1
-rw-r--r--config.c15
-rw-r--r--config.h1
-rw-r--r--skinnopacity.c12
4 files changed, 17 insertions, 12 deletions
diff --git a/HISTORY b/HISTORY
index ef4beec..1eef112 100644
--- a/HISTORY
+++ b/HISTORY
@@ -191,3 +191,4 @@ Version 0.1.1
- Fixed crash / hang if menu is opened with small screen size
- Background of ChannelDisplay configurable also to cover channel logo
- Added standalone RSS Feed
+- check for Slash at end of startup path parameters
diff --git a/config.c b/config.c
index d795033..084ba76 100644
--- a/config.c
+++ b/config.c
@@ -261,20 +261,29 @@ void cNopacityConfig::loadRssFeeds(void) {
void cNopacityConfig::SetLogoPath(cString path) {
- logoPath = path;
+ logoPath = checkSlashAtEnd(*path);
logoPathSet = true;
}
void cNopacityConfig::SetIconPath(cString path) {
- iconPath = path;
+ iconPath = checkSlashAtEnd(*path);
iconPathSet = true;
}
void cNopacityConfig::SetEpgImagePath(cString path) {
- epgImagePath = path;
+ epgImagePath = checkSlashAtEnd(*path);
epgImagePathSet = true;
}
+cString cNopacityConfig::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 cNopacityConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
else if (strcmp(Name, "channelFadeTime") == 0) channelFadeTime = atoi(Value);
diff --git a/config.h b/config.h
index dc6eeca..ab44d01 100644
--- a/config.h
+++ b/config.h
@@ -8,6 +8,7 @@ struct RssFeed {
class cNopacityConfig {
private:
+ cString checkSlashAtEnd(std::string path);
public:
cNopacityConfig();
~cNopacityConfig();
diff --git a/skinnopacity.c b/skinnopacity.c
index f24b9a4..3085489 100644
--- a/skinnopacity.c
+++ b/skinnopacity.c
@@ -73,26 +73,20 @@ bool cPluginNopacity::ProcessArgs(int argc, char *argv[])
};
int c;
- cString *path = NULL;
while ((c = getopt_long(argc, argv, "e:l:i:", long_options, NULL)) != -1) {
switch (c) {
case 'l':
- path = new cString(optarg);
- config.SetLogoPath(*path);
+ config.SetLogoPath(cString(optarg));
break;
case 'e':
- path = new cString(optarg);
- config.SetEpgImagePath(*path);
+ config.SetEpgImagePath(cString(optarg));
break;
case 'i':
- path = new cString(optarg);
- config.SetIconPath(*path);
+ config.SetIconPath(cString(optarg));
break;
default:
return false;
}
- if (path)
- delete path;
}
return true;
}