19 xmlFileName(
const std::string & fname,
const std::string & prefix){
20 if (fs::exists(fname) )
return fname;
21 std::string fileWithPrefix = prefix +
"/" + fname;
22 if (fs::exists(fileWithPrefix) )
return fileWithPrefix;
24 const char* xmlpathenv = std::getenv (
"XMLPATH");
25 if (xmlpathenv ==
nullptr)
return "";
26 std::string xmlpath = xmlpathenv;
27 std::string::size_type pos = 0;
28 std::string temp_name;
29 while (pos != std::string::npos){
30 std::string::size_type sep = xmlpath.find (
":", pos);
31 if (sep == std::string::npos){
32 temp_name = xmlpath.substr (pos);
33 pos = std::string::npos;
35 temp_name = xmlpath.substr (pos, sep - pos);
38 if (temp_name.empty())
continue;
39 std::string last_temp_name = temp_name;
42 if (fs::exists (temp_name))
return temp_name;
44 if (prefix !=
"" &&
'/' != prefix[0]) {
45 temp_name = std::move(last_temp_name);
50 if (fs::exists (temp_name))
return temp_name;