diff options
author | louis <louis.braun@gmx.de> | 2013-04-10 17:15:16 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-04-10 17:15:16 +0200 |
commit | 553d67045ed05184f98ee707b2b1fd2d38f45f60 (patch) | |
tree | 71c3bbb095142956815dc90406698f1e08c6a7bb | |
parent | e269a87fc24964fbaac485d6a60f3c331ed321a6 (diff) | |
download | skin-nopacity-553d67045ed05184f98ee707b2b1fd2d38f45f60.tar.gz skin-nopacity-553d67045ed05184f98ee707b2b1fd2d38f45f60.tar.bz2 |
check for Slash at end of startup path parameters
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | config.c | 15 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | skinnopacity.c | 12 |
4 files changed, 17 insertions, 12 deletions
@@ -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 @@ -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); @@ -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; } |