路径转换
int kbd_public::CCommonConfigParse::makeConfigFileFullPath(const std::string &strFilePath,
const std::string &strFileName,
std::string &strFullPath)
{
namespace fs = boost::filesystem;
fs::path objPath = strFilePath;
objPath /= strFileName;
if (objPath.is_absolute())
{
strFullPath = objPath.string();
return kbdSuccess;
}
/* @brief 如果传入的是相对路径,转换为绝对路径 */
string strCurDir = CFileUtil::getCurModuleDir();
if (strCurDir.empty())
{
LOGERROR("获取程序所在路径失败");
return kbdFailed;
}
fs::path objFullPath = strCurDir;
objFullPath /= objPath;
strFullPath = objFullPath.string();
return kbdSuccess;
}
浙公网安备 33010602011771号