Commit ad356e32 authored by berak's avatar berak

dnn/samples: handle not set env vars gracefully

parent c8fc8d21
......@@ -58,10 +58,12 @@ std::string findFile(const std::string& filename)
if (filename.empty() || utils::fs::exists(filename))
return filename;
std::string extraPaths[] = {getenv("OPENCV_DNN_TEST_DATA_PATH"),
const char* extraPaths[] = {getenv("OPENCV_DNN_TEST_DATA_PATH"),
getenv("OPENCV_TEST_DATA_PATH")};
for (int i = 0; i < 2; ++i)
{
if (extraPaths[i] == NULL)
continue;
std::string absPath = utils::fs::join(extraPaths[i], utils::fs::join("dnn", filename));
if (utils::fs::exists(absPath))
return absPath;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment