From 01e17ac06a7066f881ff614c634a8e61429e29ef Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Fri, 19 Dec 2014 15:10:38 +0100 Subject: 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 --- parameter/ParameterMgr.cpp | 12 +++++++----- 1 file 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; -- cgit v1.1