aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rocard <kevinx.rocard@intel.com>2014-12-19 15:10:38 +0100
committerEric Laurent <elaurent@google.com>2015-04-24 13:32:47 -0700
commit01e17ac06a7066f881ff614c634a8e61429e29ef (patch)
tree8bbdc18f13ef3fd6383a2efd8eb218e26cf2332c
parent0a7b18ef0f72b4a90b663c0564de632a70d6bc5f (diff)
downloadexternal_parameter-framework-01e17ac06a7066f881ff614c634a8e61429e29ef.zip
external_parameter-framework-01e17ac06a7066f881ff614c634a8e61429e29ef.tar.gz
external_parameter-framework-01e17ac06a7066f881ff614c634a8e61429e29ef.tar.bz2
Handle config path without slash
If the parameter configuration file path does not contain a "/" it used to assert as it could not find it's folder. Use "." this case. Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com>
-rw-r--r--parameter/ParameterMgr.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index fb09a7f..2e66c02 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -343,11 +343,13 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) :
}
// Configuration file folder
- uint32_t uiSlashPos = _strXmlConfigurationFilePath.rfind('/', -1);
-
- assert(uiSlashPos != (uint32_t)-1);
-
- _strXmlConfigurationFolderPath = _strXmlConfigurationFilePath.substr(0, uiSlashPos);
+ std::string::size_type slashPos = _strXmlConfigurationFilePath.rfind('/', -1);
+ if(slashPos == std::string::npos) {
+ // Configuration folder is the current folder
+ _strXmlConfigurationFolderPath = '.';
+ } else {
+ _strXmlConfigurationFolderPath = _strXmlConfigurationFilePath.substr(0, slashPos);
+ }
// Schema absolute folder location
_strSchemaFolderLocation = _strXmlConfigurationFolderPath + "/" + gacSystemSchemasSubFolder;