From 553d67045ed05184f98ee707b2b1fd2d38f45f60 Mon Sep 17 00:00:00 2001 From: louis Date: Wed, 10 Apr 2013 17:15:16 +0200 Subject: check for Slash at end of startup path parameters --- HISTORY | 1 + config.c | 15 ++++++++++++--- config.h | 1 + skinnopacity.c | 12 +++--------- 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; } -- cgit v1.2.3