diff --git a/src/config/XmlSupport.cxx b/src/config/XmlSupport.cxx index c507fb6..fac9065 100644 --- a/src/config/XmlSupport.cxx +++ b/src/config/XmlSupport.cxx @@ -274,7 +274,7 @@ bool XmlSupport::load_default_files() cfg_file += default_configuration_file_name(); std::string normalized_path = utils::normalize_path(cfg_file).c_str(); - if (RTIOsapiUtility_fileExists(normalized_path.c_str())) { + if (utils::file_exists(normalized_path)) { parse_file(normalized_path); } else { // If files aren't in the default location, try to load the default @@ -285,7 +285,7 @@ bool XmlSupport::load_default_files() cfg_file += default_configuration_file_name(); normalized_path = utils::normalize_path(cfg_file).c_str(); - if (RTIOsapiUtility_fileExists(normalized_path.c_str())) { + if (utils::file_exists(normalized_path)) { parse_file(normalized_path); } else { GATEWAYLog_warn( @@ -295,7 +295,7 @@ bool XmlSupport::load_default_files() } // Load the user file name (from working directory only) - if (RTIOsapiUtility_fileExists(user_configuration_file_name().c_str())) { + if (utils::file_exists(user_configuration_file_name())) { parse_file(user_configuration_file_name()); } else { GATEWAYLog_warn( diff --git a/src/service/Utils.hpp b/src/service/Utils.hpp index 652afe0..52e22cf 100644 --- a/src/service/Utils.hpp +++ b/src/service/Utils.hpp @@ -70,6 +70,15 @@ static std::string executable_path() return std::string(path); } +static bool file_exists(const std::string& filename) +{ +#if RTI_DDS_VERSION_MAJOR >= 7 && RTI_DDS_VERSION_MINOR >= 1 + return static_cast(RTIOsapiFile_exists(filename.c_str())); +#else + return static_cast(RTIOsapiUtility_fileExists(filename.c_str())); +#endif +} + class Thread { public: Thread(const std::string& name = std::string("Thread"),