aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'reference_model/src/main.cpp')
-rw-r--r--reference_model/src/main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/reference_model/src/main.cpp b/reference_model/src/main.cpp
index 24784b5..8539a0b 100644
--- a/reference_model/src/main.cpp
+++ b/reference_model/src/main.cpp
@@ -625,7 +625,16 @@ int initTestDesc(json& test_desc)
// Overwrite flatbuffer_dir/output_dir with dirname(g_func_config.test_desc) if it's not specified.
if (g_func_config.flatbuffer_dir.empty() || g_func_config.output_dir.empty())
{
- std::string test_dir = g_func_config.test_desc.substr(0, g_func_config.test_desc.find_last_of("/\\"));
+ auto slash_pos = g_func_config.test_desc.find_last_of("/\\");
+ std::string test_dir;
+ if (slash_pos != std::string::npos)
+ {
+ test_dir = g_func_config.test_desc.substr(0, slash_pos);
+ }
+ else
+ {
+ test_dir = std::string(".");
+ }
if (g_func_config.flatbuffer_dir.empty())
{
g_func_config.flatbuffer_dir = test_dir;