OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CORE] Ov file path util part2 (#28854)
barnasm1b5a91e1ab0a9
diff --git a/src/common/util/include/openvino/util/file_util.hpp b/src/common/util/include/openvino/util/file_util.hppindex 928a8fd1635..ee6ea7a7e57 100644--- a/src/common/util/include/openvino/util/file_util.hpp+++ b/src/common/util/include/openvino/util/file_util.hpp@@ -7,6 +7,7 @@#include <cstdint>#include <fstream>#include <functional>+#include <initializer_list>#include <string>#include <vector>@@ -150,16 +151,7 @@ void create_directory_recursive(const std::wstring& path);* @param path - path to directory* @return true if directory exists, false otherwise*/-bool directory_exists(const std::string& path);--#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT-/**- * @brief Interface function to check if directory exists for given path- * @param path - path to directory wide-string- * @return true if directory exists, false otherwise- */-bool directory_exists(const std::wstring& path);-#endif+bool directory_exists(const ov::util::Path& path);/*** @brief Returns file size for file@@ -223,8 +215,10 @@ inline bool file_exists(const std::string& path) {}std::string get_file_ext(const std::string& path);-std::string get_directory(const std::string& path);-std::string path_join(const std::vector<std::string>& paths);+ov::util::Path get_directory(const ov::util::Path& path);++ov::util::Path path_join(std::initializer_list<ov::util::Path>&& paths);+std::wstring path_join_w(std::initializer_list<std::wstring>&& paths);void iterate_files(const std::string& path,const std::function<void(const std::string& file, bool is_dir)>& func,@@ -235,35 +229,19 @@ void convert_path_win_style(std::string& path);std::string get_ov_lib_path();-#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT--using FilePath = std::wstring;--inline std::string from_file_path(const FilePath& path) {- return wstring_to_string(path);-}+// TODO: remove this using. replace with Path.+using FilePath = ov::util::Path::string_type;-inline FilePath to_file_path(const std::string& path) {- return string_to_wstring(path);+// TODO: remove this function after get_plugin_path using Path+inline std::string from_file_path(const ov::util::Path& path) {+ return path.string();}-std::wstring get_directory(const std::wstring& path);-std::wstring path_join_w(const std::vector<std::wstring>& paths);--#else--using FilePath = std::string;--inline std::string from_file_path(const FilePath& path) {- return path;+// TODO: remove this function after all calls use Path+inline FilePath to_file_path(const ov::util::Path& path) {+ return path.native();}-inline FilePath to_file_path(const std::string& path) {- return path;-}--#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT-#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT/**diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cppindex c454eacba7d..3d3505d80bd 100644--- a/src/common/util/src/file_util.cpp+++ b/src/common/util/src/file_util.cpp@@ -91,115 +91,37 @@ std::string ov::util::get_file_ext(const std::string& s) {return rc;}-std::string ov::util::get_directory(const std::string& s) {- // Linux-style separator- auto pos = s.find_last_of('/');- if (pos != std::string::npos) {- return s.substr(0, pos ? pos : 1);- }- // Windows-style separator- pos = s.find_last_of('\\');- if (pos != std::string::npos) {- return s.substr(0, pos);- } else if (s.empty()) {- return {};- } else {- return {'.'};- }-}--#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT-std::wstring ov::util::get_directory(const std::wstring& s) {- auto pos = s.find_last_of(ov::util::FileTraits<wchar_t>::file_separator);- if (pos != std::wstring::npos) {- return s.substr(0, pos);- } else if (s.empty()) {+ov::util::Path ov::util::get_directory(const ov::util::Path& path) {+ if (path.empty()) {return {};+ } else if (const auto& parent_path = path.parent_path(); parent_path.empty()) {+ return {"."};} else {- return {L'.'};+ return parent_path;}}-#endif-namespace {+template <class Container = std::initializer_list<ov::util::Path>>+ov::util::Path path_join(Container&& paths) {+ ov::util::Path joined_path{};-std::string join_paths(const std::string& s1, const std::string& s2) {- std::string rc;- if (s2.size() > 0) {- if (s2[0] == '/') {- rc = s2;- } else if (s1.size() > 0) {- rc = s1;- if (rc[rc.size() - 1] != '/') {-#ifndef _WIN32- rc += '/';-#else- rc += '\\';-#endif- }- rc += s2;- } else {- rc = s2;+ for (auto&& path : paths) {+ if (!path.empty()) {+ joined_path /= path;}- } else {- rc = s1;}- return rc;+ return joined_path;}-#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT-std::wstring join_paths(const std::wstring& s1, const std::wstring& s2) {- std::wstring rc;- if (s2.size() > 0) {- if (s2[0] == '/') {- rc = s2;- } else if (s1.size() > 0) {- rc = s1;- if (rc[rc.size() - 1] != '/') {-# ifndef _WIN32- rc += '/';-# else- rc += '\\';-# endif- }- rc += s2;- } else {- rc = s2;- }- } else {- rc = s1;- }- return rc;+// TODO: Remove string() / wstring() casts on function call site+ov::util::Path ov::util::path_join(std::initializer_list<ov::util::Path>&& paths) {+ return ::path_join<>(std::move(paths));}-#endif-} // namespace-std::string ov::util::path_join(const std::vector<std::string>& paths) {- std::string result;- if (paths.empty()) {- return result;- }- result = paths[0];- for (size_t i = 1; i < paths.size(); i++) {- result = join_paths(result, paths[i]);- }- return result;+std::wstring ov::util::path_join_w(std::initializer_list<std::wstring>&& paths) {+ return ::path_join<>(std::move(paths)).wstring();}-#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT-std::wstring ov::util::path_join_w(const std::vector<std::wstring>& paths) {- std::wstring result;- if (paths.empty()) {- return result;- }- result = paths[0];- for (size_t i = 1; i < paths.size(); i++) {- result = join_paths(result, paths[i]);- }- return result;-}-#endif-#ifndef _WIN32static void iterate_files_worker(const std::string& path,const std::function<void(const std::string& file, bool is_dir)>& func,@@ -403,29 +325,9 @@ void ov::util::create_directory_recursive(const std::string& path) {}}-bool ov::util::directory_exists(const std::string& path) {- struct stat sb;-- if (stat(path.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) {- return true;- }- return false;-}--#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT-bool ov::util::directory_exists(const std::wstring& path) {-# ifdef _WIN32- struct stat sb;-- if (wstat(path.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) {- return true;- }- return false;-# else- return directory_exists(wstring_to_string(path));-# endif+bool ov::util::directory_exists(const ov::util::Path& path) {+ return std::filesystem::is_directory(std::filesystem::status(path));}-#endifnamespace {@@ -538,12 +440,12 @@ ov::util::FilePath ov::util::get_compiled_plugin_path(const std::string& plugin)str << "openvino-" << OpenVINO_VERSION;const auto sub_folder = str.str();- std::string abs_file_path = ov::util::path_join({ov_library_path, sub_folder, plugin});+ std::string abs_file_path = ov::util::path_join({ov_library_path, sub_folder, plugin}).string();if (ov::util::file_exists(abs_file_path))return ov::util::to_file_path(abs_file_path);// 2. in the openvino.so location- abs_file_path = ov::util::path_join({ov_library_path, plugin});+ abs_file_path = ov::util::path_join({ov_library_path, plugin}).string();if (ov::util::file_exists(abs_file_path))return ov::util::to_file_path(abs_file_path);@@ -573,11 +475,11 @@ ov::util::FilePath ov::util::get_plugin_path(const std::string& plugin, const stauto xml_path_ = xml_path;if (xml_path.find(ov::util::FileTraits<char>::file_separator) == std::string::npos)- xml_path_ = ov::util::path_join({std::string("."), xml_path}); // treat plugins.xml as CWD/plugins.xml+ xml_path_ = ov::util::path_join({".", xml_path}).string(); // treat plugins.xml as CWD/plugins.xml// For 2nd caseif (plugin.find(ov::util::FileTraits<char>::file_separator) != std::string::npos) {- auto path_ = ov::util::path_join({ov::util::get_directory(xml_path_), plugin});+ auto path_ = ov::util::path_join({ov::util::get_directory(xml_path_), plugin}).string();return ov::util::to_file_path(ov::util::get_absolute_file_path(path_)); // canonicalize path}@@ -587,7 +489,7 @@ ov::util::FilePath ov::util::get_plugin_path(const std::string& plugin, const stlib_file_name = ov::util::make_plugin_library_name({}, plugin);// For 4th case- auto lib_path = ov::util::path_join({ov::util::get_directory(xml_path_), lib_file_name});+ auto lib_path = ov::util::path_join({ov::util::get_directory(xml_path_), lib_file_name}).string();lib_path = ov::util::get_absolute_file_path(lib_path); // canonicalize pathif (as_abs_only || ov::util::file_exists(lib_path))return ov::util::to_file_path(lib_path);diff --git a/src/core/tests/check.cpp b/src/core/tests/check.cppindex 06ae3356f3d..f903d95c224 100644--- a/src/core/tests/check.cpp+++ b/src/core/tests/check.cpp@@ -54,7 +54,7 @@ TEST(check, ov_throw_exception_check_relative_path_to_source) {GTEST_SKIP();}using namespace testing;- const auto path = ov::util::path_join({"src", "core", "tests", "check.cpp"});+ const auto path = ov::util::path_join({"src", "core", "tests", "check.cpp"}).string();const auto exp_native_slash = "Exception from " + path + ":";const auto exp_fwd_slash = "Exception from src/core/tests/check.cpp:";OV_EXPECT_THROW(OPENVINO_THROW("Test message"),diff --git a/src/core/tests/file_util.cpp b/src/core/tests/file_util.cppindex 8841a297f47..9295af35813 100644--- a/src/core/tests/file_util.cpp+++ b/src/core/tests/file_util.cpp@@ -22,66 +22,66 @@ TEST(file_util, path_join) {string s1 = "";string s2 = "";- EXPECT_STREQ("", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("", ov::util::path_join({s1, s2}));}{string s1 = "";string s2 = "/test1/test2";- EXPECT_STREQ("/test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/test1/test2", ov::util::path_join({s1, s2}));}{string s1 = "";string s2 = "/test1/test2/";- EXPECT_STREQ("/test1/test2/", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/test1/test2/", ov::util::path_join({s1, s2}));}{string s1 = "";string s2 = "test1/test2";- EXPECT_STREQ("test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("test1/test2", ov::util::path_join({s1, s2}));}{string s1 = "/x1/x2";string s2 = "";- EXPECT_STREQ("/x1/x2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/x1/x2", ov::util::path_join({s1, s2}));}{string s1 = "/x1/x2/";string s2 = "/";- EXPECT_STREQ("/", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/", ov::util::path_join({s1, s2}));}{string s1 = "/x1/x2";string s2 = "/test1/test2";- EXPECT_STREQ("/test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/test1/test2", ov::util::path_join({s1, s2}));}{string s1 = "/x1/x2/";string s2 = "test1/test2";- EXPECT_STREQ("/x1/x2/test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/x1/x2/test1/test2", ov::util::path_join({s1, s2}));}{string s1 = "/x1/x2";string s2 = "test1/test2";#ifndef _WIN32- EXPECT_STREQ("/x1/x2/test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/x1/x2/test1/test2", ov::util::path_join({s1, s2}));#else- EXPECT_STREQ("/x1/x2\\test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/x1/x2\\test1/test2", ov::util::path_join({s1, s2}));#endif}{string s1 = "/";string s2 = "test1/test2";- EXPECT_STREQ("/test1/test2", ov::util::path_join({s1, s2}).c_str());+ EXPECT_EQ("/test1/test2", ov::util::path_join({s1, s2}));}}@@ -124,32 +124,32 @@ protected:};TEST_F(TrimFileTest, relative_path_to_source) {- const auto exp_path = ov::util::path_join({"src", "test_src.cpp"});+ const auto exp_path = ov::util::path_join({"src", "test_src.cpp"}).string();- const auto file_path = ov::util::path_join({"..", "..", "..", project_dir_name, "src", "test_src.cpp"});+ const auto file_path = ov::util::path_join({"..", "..", "..", project_dir_name, "src", "test_src.cpp"}).string();auto str_ptr = ov::util::trim_file_name(file_path.c_str());EXPECT_EQ(exp_path, str_ptr);}TEST_F(TrimFileTest, relative_path_to_source_but_no_project_dir) {- const auto file_path = ov::util::path_join({"..", "..", "..", "src", "test_src.cpp"});+ const auto file_path = ov::util::path_join({"..", "..", "..", "src", "test_src.cpp"}).string();auto str_ptr = ov::util::trim_file_name(file_path.c_str());EXPECT_EQ(file_path, str_ptr);}TEST_F(TrimFileTest, absolute_path_to_source) {- const auto exp_path = ov::util::path_join({"src", "test_src.cpp"});+ const auto exp_path = ov::util::path_join({"src", "test_src.cpp"}).string();- const auto file_path = ov::util::path_join({"home", "user", project_dir_name, "src", "test_src.cpp"});+ const auto file_path = ov::util::path_join({"home", "user", project_dir_name, "src", "test_src.cpp"}).string();auto str_ptr = ov::util::trim_file_name(file_path.c_str());EXPECT_EQ(exp_path, str_ptr);}TEST_F(TrimFileTest, absolute_path_to_source_but_no_project_dir) {- const auto file_path = ov::util::path_join({"home", "user", "src", "test_src.cpp"});+ const auto file_path = ov::util::path_join({"home", "user", "src", "test_src.cpp"}).string();auto str_ptr = ov::util::trim_file_name(file_path.c_str());EXPECT_EQ(file_path, str_ptr);diff --git a/src/core/tests/frontend/frontend_manager.cpp b/src/core/tests/frontend/frontend_manager.cppindex c81af32cb12..cc3d621196f 100644--- a/src/core/tests/frontend/frontend_manager.cpp+++ b/src/core/tests/frontend/frontend_manager.cpp@@ -17,7 +17,7 @@ using namespace ov::frontend;static std::string mock_fe_path() {static auto lib_name = std::string(FRONTEND_LIB_PREFIX) + "mock1" + std::string(FRONTEND_LIB_SUFFIX);- return ov::util::path_join({ov::test::utils::getExecutableDirectory(), lib_name});+ return ov::util::path_join({ov::test::utils::getExecutableDirectory(), lib_name}).string();}TEST(FrontEndManagerTest, testAvailableFrontEnds) {diff --git a/src/core/tests/pass/serialization/deterministicity.cpp b/src/core/tests/pass/serialization/deterministicity.cppindex c6ac7f58a02..972a8080943 100644--- a/src/core/tests/pass/serialization/deterministicity.cpp+++ b/src/core/tests/pass/serialization/deterministicity.cpp@@ -72,7 +72,7 @@ protected:TEST_F(SerializationDeterministicityTest, BasicModel) {const std::string model =- ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc.onnx"}));+ ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc.onnx"}).string());auto expected = ov::test::readModel(model, "");ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected);@@ -89,7 +89,7 @@ TEST_F(SerializationDeterministicityTest, BasicModel) {TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) {const std::string model =- ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/addmul_abc.onnx"}));+ ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/addmul_abc.onnx"}).string());auto expected = ov::test::readModel(model, "");ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected);@@ -107,10 +107,10 @@ TEST_F(SerializationDeterministicityTest, ModelWithMultipleLayers) {#endifTEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) {- const std::string model =- ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.xml"}));- const std::string weights =- ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.bin"}));+ const std::string model = ov::test::utils::getModelFromTestModelZoo(+ ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.xml"}).string());+ const std::string weights = ov::test::utils::getModelFromTestModelZoo(+ ov::util::path_join({SERIALIZED_ZOO, "ir/split_equal_parts_2d.bin"}).string());auto expected = ov::test::readModel(model, weights);ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected);@@ -126,10 +126,10 @@ TEST_F(SerializationDeterministicityTest, ModelWithMultipleOutputs) {}TEST_F(SerializationDeterministicityTest, ModelWithConstants) {- const std::string model =- ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.xml"}));- const std::string weights =- ov::test::utils::getModelFromTestModelZoo(ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.bin"}));+ const std::string model = ov::test::utils::getModelFromTestModelZoo(+ ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.xml"}).string());+ const std::string weights = ov::test::utils::getModelFromTestModelZoo(+ ov::util::path_join({SERIALIZED_ZOO, "ir/add_abc_initializers.bin"}).string());auto expected = ov::test::readModel(model, weights);ov::pass::Serialize(m_out_xml_path_1, m_out_bin_path_1).run_on_model(expected);diff --git a/src/core/tests/pass/serialization/serialize.cpp b/src/core/tests/pass/serialization/serialize.cppindex 46185f6f270..f4195350476 100644--- a/src/core/tests/pass/serialization/serialize.cpp+++ b/src/core/tests/pass/serialization/serialize.cpp@@ -39,10 +39,10 @@ public:void SetUp() override {m_model_path = ov::test::utils::getModelFromTestModelZoo(- ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<0>(GetParam())}));+ ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<0>(GetParam())}).string());if (!std::get<1>(GetParam()).empty()) {m_binary_path = ov::test::utils::getModelFromTestModelZoo(- ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<1>(GetParam())}));+ ov::util::path_join({SERIALIZED_ZOO, "ir/", std::get<1>(GetParam())}).string());}std::string filePrefix = ov::test::utils::generateTestFilePrefix();diff --git a/src/core/tests/pass/visualize_tree.cpp b/src/core/tests/pass/visualize_tree.cppindex d9a364db34e..ff43f292d4e 100644--- a/src/core/tests/pass/visualize_tree.cpp+++ b/src/core/tests/pass/visualize_tree.cpp@@ -39,7 +39,7 @@ protected:}const std::string vt_svg_file_path =- util::path_join({utils::getExecutableDirectory(), utils::generateTestFilePrefix() + "_tree.svg"});+ util::path_join({utils::getExecutableDirectory(), utils::generateTestFilePrefix() + "_tree.svg"}).string();const std::string dot_file_path = vt_svg_file_path + ".dot";};diff --git a/src/frontends/onnx/frontend/src/utils/onnx_internal.cpp b/src/frontends/onnx/frontend/src/utils/onnx_internal.cppindex 18edc12d619..a5b68b8f9d9 100644--- a/src/frontends/onnx/frontend/src/utils/onnx_internal.cpp+++ b/src/frontends/onnx/frontend/src/utils/onnx_internal.cpp@@ -15,10 +15,7 @@using namespace ov;-namespace ov {-namespace frontend {-namespace onnx {-namespace detail {+namespace ov::frontend::onnx::detail {namespace {void remove_dangling_parameters(std::shared_ptr<ov::Model>& model) {const auto parameters = model->get_parameters();@@ -94,7 +91,7 @@ std::shared_ptr<ov::Model> import_onnx_model(std::shared_ptr<ModelProto> model_pdetail::MappedMemoryHandles mmap_cache,ov::frontend::ExtensionHolder extensions) {apply_transformations(*model_proto);- Graph graph{ov::util::get_directory(model_path), model_proto, mmap_cache, std::move(extensions)};+ Graph graph{ov::util::get_directory(model_path).string(), model_proto, mmap_cache, std::move(extensions)};return graph.convert();}@@ -103,10 +100,7 @@ std::shared_ptr<ov::Model> decode_to_framework_nodes(std::shared_ptr<ModelProto>detail::MappedMemoryHandles mmap_cache,ov::frontend::ExtensionHolder extensions) {apply_transformations(*model_proto);- auto graph = std::make_shared<Graph>(ov::util::get_directory(model_path), model_proto, mmap_cache, extensions);+ auto graph = std::make_shared<Graph>(ov::util::get_directory(model_path).string(), model_proto, mmap_cache, extensions);return graph->decode();}-} // namespace detail-} // namespace onnx-} // namespace frontend-} // namespace ov+} // namespace ov::frontend::onnx::detaildiff --git a/src/frontends/onnx/frontend/src/utils/tensor_external_data.cpp b/src/frontends/onnx/frontend/src/utils/tensor_external_data.cppindex da58ddbe57e..433fbaf7884 100644--- a/src/frontends/onnx/frontend/src/utils/tensor_external_data.cpp+++ b/src/frontends/onnx/frontend/src/utils/tensor_external_data.cpp@@ -36,7 +36,7 @@ TensorExternalData::TensorExternalData(const TensorProto& tensor) {Buffer<ov::MappedMemory> TensorExternalData::load_external_mmap_data(const std::string& model_dir,MappedMemoryHandles cache) const {- const auto full_path = ov::util::get_absolute_file_path(ov::util::path_join({model_dir, m_data_location}));+ const auto full_path = ov::util::get_absolute_file_path(ov::util::path_join({model_dir, m_data_location}).string());const int64_t file_size = ov::util::file_size(full_path);if (file_size <= 0 || m_offset + m_data_length > static_cast<uint64_t>(file_size)) {throw error::invalid_external_data{*this};@@ -59,7 +59,7 @@ Buffer<ov::MappedMemory> TensorExternalData::load_external_mmap_data(const std::}Buffer<ov::AlignedBuffer> TensorExternalData::load_external_data(const std::string& model_dir) const {- auto full_path = ov::util::get_absolute_file_path(ov::util::path_join({model_dir, m_data_location}));+ auto full_path = ov::util::get_absolute_file_path(ov::util::path_join({model_dir, m_data_location}).string());#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)ov::util::convert_path_win_style(full_path);std::ifstream external_data_stream(ov::util::string_to_wstring(full_path).c_str(),diff --git a/src/frontends/onnx/tests/lib_close.cpp b/src/frontends/onnx/tests/lib_close.cppindex 4d4576034fe..edbab535207 100644--- a/src/frontends/onnx/tests/lib_close.cpp+++ b/src/frontends/onnx/tests/lib_close.cpp@@ -11,10 +11,11 @@using namespace testing;using namespace ov::util;-INSTANTIATE_TEST_SUITE_P(ONNX,- FrontendLibCloseTest,- Values(std::make_tuple("onnx",- path_join({std::string(TEST_ONNX_MODELS_DIRNAME),- std::string("external_data/external_data.onnx")}),- "Y")),- FrontendLibCloseTest::get_test_case_name);+INSTANTIATE_TEST_SUITE_P(+ ONNX,+ FrontendLibCloseTest,+ Values(std::make_tuple(+ "onnx",+ path_join({std::string(TEST_ONNX_MODELS_DIRNAME), std::string("external_data/external_data.onnx")}).string(),+ "Y")),+ FrontendLibCloseTest::get_test_case_name);diff --git a/src/frontends/onnx/tests/load_from.cpp b/src/frontends/onnx/tests/load_from.cppindex 1cb58a7318a..6ad0c775692 100644--- a/src/frontends/onnx/tests/load_from.cpp+++ b/src/frontends/onnx/tests/load_from.cpp@@ -30,8 +30,10 @@ static LoadFromFEParam getTestData() {}TEST_P(FrontEndLoadFromTest, testLoadFromStreamAndPassPath) {- const auto path = ov::util::path_join(- {ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "external_data/external_data.onnx"});+ const auto path =+ ov::util::path_join(+ {ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "external_data/external_data.onnx"})+ .string();std::ifstream ifs(path, std::ios::in | std::ios::binary);ASSERT_TRUE(ifs.is_open()) << "Could not open an ifstream for the model path: " << path;std::istream* is = &ifs;@@ -64,7 +66,8 @@ TEST_P(FrontEndLoadFromTest, load_model_not_exists_at_path) {TEST_P(FrontEndLoadFromTest, load_model_and_apply_ppp) {auto model_file_path =- ov::util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, m_param.m_stream});+ ov::util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, m_param.m_stream})+ .string();m_frontEnd = m_fem.load_by_model(model_file_path);const auto fe_model = m_frontEnd->load(model_file_path);@@ -98,7 +101,7 @@ using ::ONNX_NAMESPACE::Version;TEST_P(FrontEndLoadFromTest, testLoadFromModelProtoUint64) {const auto path =- ov::util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "abs.onnx"});+ ov::util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "abs.onnx"}).string();std::ifstream ifs(path, std::ios::in | std::ios::binary);ASSERT_TRUE(ifs.is_open()) << "Could not open an ifstream for the model path: " << path;std::vector<std::string> frontends;@@ -126,7 +129,7 @@ TEST_P(FrontEndLoadFromTest, testLoadFromModelProtoUint64) {TEST_P(FrontEndLoadFromTest, testLoadFromModelProtoUint64_Negative) {const auto path =- ov::util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "abs.onnx"});+ ov::util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "abs.onnx"}).string();std::ifstream ifs(path, std::ios::in | std::ios::binary);ASSERT_TRUE(ifs.is_open()) << "Could not open an ifstream for the model path: " << path;std::vector<std::string> frontends;diff --git a/src/frontends/onnx/tests/onnx_import_convpool.in.cpp b/src/frontends/onnx/tests/onnx_import_convpool.in.cppindex 8080ff178bf..cd944d44929 100644--- a/src/frontends/onnx/tests/onnx_import_convpool.in.cpp+++ b/src/frontends/onnx/tests/onnx_import_convpool.in.cpp@@ -426,14 +426,14 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_convtranspose_output_shape) {test_case.add_input_from_file<float>(util::path_join({ov::test::utils::getExecutableDirectory(),TEST_ONNX_MODELS_DIRNAME,- "files/convtranspose_output_shape/x.bin"}));+ "files/convtranspose_output_shape/x.bin"}).string());test_case.add_input_from_file<float>(util::path_join({ov::test::utils::getExecutableDirectory(),TEST_ONNX_MODELS_DIRNAME,- "files/convtranspose_output_shape/w.bin"}));+ "files/convtranspose_output_shape/w.bin"}).string());test_case.add_expected_output_from_file<float>({1, 2, 10, 8},util::path_join({ov::test::utils::getExecutableDirectory(),TEST_ONNX_MODELS_DIRNAME,- "files/convtranspose_output_shape/y.bin"}));+ "files/convtranspose_output_shape/y.bin"}).string());test_case.run();}diff --git a/src/frontends/onnx/tests/onnx_import_quant.in.cpp b/src/frontends/onnx/tests/onnx_import_quant.in.cppindex 166898988a5..6268db5d35d 100644--- a/src/frontends/onnx/tests/onnx_import_quant.in.cpp+++ b/src/frontends/onnx/tests/onnx_import_quant.in.cpp@@ -428,7 +428,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_quant_conv_linear_2d) {auto test_case = ov::test::TestCase(model, s_device);test_case.add_input_from_file<uint8_t>(- util::path_join({ ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "files/qlinearconv2d/x.bin" }));+ util::path_join({ ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "files/qlinearconv2d/x.bin" }).string());test_case.add_input(std::vector<float>{0.00369204697199166f}); // x_scaletest_case.add_input(std::vector<uint8_t>{132}); // x_zero_pointtest_case.add_input(std::vector<uint8_t>{0}); // w@@ -438,7 +438,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_quant_conv_linear_2d) {test_case.add_input(std::vector<uint8_t>{123}); // y_zero_pointtest_case.add_expected_output_from_file<uint8_t>({ 1, 1, 7, 7 },- util::path_join({ ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "files/qlinearconv2d/y.bin" }));+ util::path_join({ ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "files/qlinearconv2d/y.bin" }).string());test_case.run();}diff --git a/src/frontends/onnx/tests/onnx_importer_test.cpp b/src/frontends/onnx/tests/onnx_importer_test.cppindex f34e3b253c7..6dc364edd45 100644--- a/src/frontends/onnx/tests/onnx_importer_test.cpp+++ b/src/frontends/onnx/tests/onnx_importer_test.cpp@@ -114,7 +114,7 @@ TEST(ONNX_Importer_Tests, ImportModelWhenFileDoesNotExist) {TEST(ONNX_Importer_Tests, ImportModelFromStream) {auto model_file_path =- test::utils::getModelFromTestModelZoo(util::path_join({TEST_ONNX_MODELS_DIRNAME, "addmul_abc.onnx"}));+ test::utils::getModelFromTestModelZoo(util::path_join({TEST_ONNX_MODELS_DIRNAME, "addmul_abc.onnx"}).string());std::ifstream model_file_stream(model_file_path, std::ifstream::binary);ASSERT_TRUE(model_file_stream.is_open());int count_adds = 0;@@ -135,15 +135,15 @@ TEST(ONNX_Importer_Tests, ImportModelFromStream) {TEST(ONNX_Importer_Tests, ImportModelWithoutMetadata) {Core core;- auto model = core.read_model(- test::utils::getModelFromTestModelZoo(util::path_join({TEST_ONNX_MODELS_DIRNAME, "priorbox_clustered.onnx"})));+ auto model = core.read_model(test::utils::getModelFromTestModelZoo(+ util::path_join({TEST_ONNX_MODELS_DIRNAME, "priorbox_clustered.onnx"}).string()));ASSERT_FALSE(model->has_rt_info("framework"));}TEST(ONNX_Importer_Tests, ImportModelWithMetadata) {Core core;- auto model = core.read_model(- test::utils::getModelFromTestModelZoo(util::path_join({TEST_ONNX_MODELS_DIRNAME, "model_with_metadata.onnx"})));+ auto model = core.read_model(test::utils::getModelFromTestModelZoo(+ util::path_join({TEST_ONNX_MODELS_DIRNAME, "model_with_metadata.onnx"}).string()));ASSERT_TRUE(model->has_rt_info("framework"));const auto rtinfo = model->get_rt_info();diff --git a/src/frontends/onnx/tests/onnx_utils.cpp b/src/frontends/onnx/tests/onnx_utils.cppindex a9fc5cd3240..44e9fc482b6 100644--- a/src/frontends/onnx/tests/onnx_utils.cpp+++ b/src/frontends/onnx/tests/onnx_utils.cpp@@ -134,7 +134,7 @@ InputModel::Ptr load_model(const wstring& model_path, FrontEnd::Ptr* return_fron}std::string onnx_backend_manifest(const std::string& manifest) {- return ov::util::path_join({ov::test::utils::getExecutableDirectory(), manifest});+ return ov::util::path_join({ov::test::utils::getExecutableDirectory(), manifest}).string();}} // namespace testsdiff --git a/src/frontends/onnx/tests/op_extension.cpp b/src/frontends/onnx/tests/op_extension.cppindex 030059f2cf1..ffa0ceeffae 100644--- a/src/frontends/onnx/tests/op_extension.cpp+++ b/src/frontends/onnx/tests/op_extension.cpp@@ -155,7 +155,7 @@ TEST(ONNXOpExtensionViaCommonConstructor, onnx_op_extension_via_template_arg_witfe->add_extension(ext);const auto input_model = fe->load(ov::test::utils::getModelFromTestModelZoo(- ov::util::path_join({TEST_ONNX_MODELS_DIRNAME, "relu_custom_domain.onnx"})));+ ov::util::path_join({TEST_ONNX_MODELS_DIRNAME, "relu_custom_domain.onnx"}).string()));std::shared_ptr<ov::Model> model;EXPECT_NO_THROW(fe->convert(input_model));@@ -169,7 +169,7 @@ TEST(ONNXOpExtensionViaCommonConstructor, onnx_op_extension_via_ov_type_name_witfe->add_extension(ext);const auto input_model = fe->load(ov::test::utils::getModelFromTestModelZoo(- ov::util::path_join({TEST_ONNX_MODELS_DIRNAME, "relu_custom_domain.onnx"})));+ ov::util::path_join({TEST_ONNX_MODELS_DIRNAME, "relu_custom_domain.onnx"}).string()));std::shared_ptr<ov::Model> model;EXPECT_NO_THROW(fe->convert(input_model));diff --git a/src/frontends/paddle/tests/lib_close.cpp b/src/frontends/paddle/tests/lib_close.cppindex eeda197130a..29c8cbc2154 100644--- a/src/frontends/paddle/tests/lib_close.cpp+++ b/src/frontends/paddle/tests/lib_close.cpp@@ -10,10 +10,10 @@using namespace testing;using namespace ov::util;-INSTANTIATE_TEST_SUITE_P(Paddle,- FrontendLibCloseTest,- Values(std::make_tuple("paddle",- path_join({std::string(TEST_PADDLE_MODELS_DIRNAME),- std::string("conv2d_relu/conv2d_relu.pdmodel")}),- "conv2d_0.tmp_0")),- FrontendLibCloseTest::get_test_case_name);+INSTANTIATE_TEST_SUITE_P(+ Paddle,+ FrontendLibCloseTest,+ Values(std::make_tuple("paddle",+ path_join({TEST_PADDLE_MODELS_DIRNAME, "conv2d_relu/conv2d_relu.pdmodel"}).string(),+ "conv2d_0.tmp_0")),+ FrontendLibCloseTest::get_test_case_name);diff --git a/src/frontends/tensorflow/src/graph_iterator_saved_model.cpp b/src/frontends/tensorflow/src/graph_iterator_saved_model.cppindex 61a074cf110..91ac2efc73d 100644--- a/src/frontends/tensorflow/src/graph_iterator_saved_model.cpp+++ b/src/frontends/tensorflow/src/graph_iterator_saved_model.cpp@@ -33,7 +33,7 @@ bool GraphIteratorSavedModel::is_supported(const std::string& path) {if (ov::util::directory_exists(path)) {FRONT_END_GENERAL_CHECK(util::file_exists(ov::util::path_join({path, "saved_model.pb"})),"Could not open the file: \"",- util::path_to_string(ov::util::path_join({path, "saved_model.pb"})),+ ov::util::path_join({path, "saved_model.pb"}),'"');return true;} else {@@ -43,7 +43,8 @@ bool GraphIteratorSavedModel::is_supported(const std::string& path) {#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)bool GraphIteratorSavedModel::is_supported(const std::wstring& path) {- return ov::util::directory_exists(path) && ov::util::file_exists(ov::util::path_join_w({path, L"saved_model.pb"}));+ return ov::util::directory_exists(path) &&+ ov::util::file_exists(ov::util::path_join_w({path, L"saved_model.pb"}));}#endifdiff --git a/src/frontends/tensorflow/src/variables_index.cpp b/src/frontends/tensorflow/src/variables_index.cppindex f4e330518e2..20fa3bb3820 100644--- a/src/frontends/tensorflow/src/variables_index.cpp+++ b/src/frontends/tensorflow/src/variables_index.cpp@@ -195,7 +195,7 @@ bool VariablesIndex::read_variables(std::ifstream& vi_stream, const std::string&std::snprintf(suffix.data(), suffix.size(), "data-%05d-of-%05d", shard, m_total_shards);std::string fullPath;if (is_saved_model) {- fullPath = ov::util::path_join({path, "variables", std::string("variables.") + suffix.data()});+ fullPath = ov::util::path_join({path, "variables", std::string("variables.") + suffix.data()}).string();} else {fullPath = path + "." + suffix.data();}diff --git a/src/frontends/tests/frontend/shared/gtest_main_manifest/main.cpp b/src/frontends/tests/frontend/shared/gtest_main_manifest/main.cppindex 33f69894f76..6c758c3dc12 100644--- a/src/frontends/tests/frontend/shared/gtest_main_manifest/main.cpp+++ b/src/frontends/tests/frontend/shared/gtest_main_manifest/main.cpp@@ -12,7 +12,7 @@static const std::string s_manifest{#ifdef MANIFEST- ov::util::path_join({ov::test::utils::getExecutableDirectory(), MANIFEST})+ ov::util::path_join({ov::test::utils::getExecutableDirectory(), MANIFEST}).string()#endif};diff --git a/src/inference/src/cpp/core.cpp b/src/inference/src/cpp/core.cppindex 54db2eae035..60264362ce5 100644--- a/src/inference/src/cpp/core.cpp+++ b/src/inference/src/cpp/core.cpp@@ -37,12 +37,12 @@ std::string find_plugins_xml(const std::string& xml_file) {const auto sub_folder = str.str();// register plugins from default openvino-<openvino version>/plugins.xml config- auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, xml_file_name});+ auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, xml_file_name}).string();if (ov::util::file_exists(xmlConfigFileDefault))return xmlConfigFileDefault;// 2. in folder with libopenvino.so- xmlConfigFileDefault = ov::util::path_join({std::move(ov_library_path), std::move(xml_file_name)});+ xmlConfigFileDefault = ov::util::path_join({std::move(ov_library_path), std::move(xml_file_name)}).string();if (ov::util::file_exists(xmlConfigFileDefault))return xmlConfigFileDefault;diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cppindex f58ecb63826..9a6d38a1189 100644--- a/src/inference/src/dev/core_impl.cpp+++ b/src/inference/src/dev/core_impl.cpp@@ -630,7 +630,7 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {// Check that device plugin name is the same as requested for HW pluginsif (!plugin_name.empty() && !ov::is_virtual_device(plugin_name)) {OPENVINO_ASSERT(deviceName.find(plugin_name) != std::string::npos,- ov::util::wstring_to_string(desc.libraryLocation.c_str()),+ desc.libraryLocation," is used for ",deviceName," , while it contains implementation for ",@@ -749,7 +749,7 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {return plugins.emplace(deviceName, plugin).first->second;} catch (const ov::Exception& ex) {OPENVINO_THROW("Failed to create plugin ",- ov::util::from_file_path(desc.libraryLocation),+ desc.libraryLocation," for device ",deviceName,"\n",diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hppindex 895331d5b36..bb5c1127946 100644--- a/src/inference/src/dev/core_impl.hpp+++ b/src/inference/src/dev/core_impl.hpp@@ -5,8 +5,8 @@#pragma once#include "cache_guard.hpp"-#include "dev/plugin.hpp"#include "cache_manager.hpp"+#include "dev/plugin.hpp"#include "openvino/core/any.hpp"#include "openvino/core/extension.hpp"#include "openvino/core/so_extension.hpp"@@ -172,7 +172,7 @@ private:mutable ov::CacheGuard cacheGuard;struct PluginDescriptor {- ov::util::FilePath libraryLocation;+ ov::util::Path libraryLocation;ov::AnyMap defaultConfig;std::vector<ov::util::FilePath> listOfExtentions;CreatePluginEngineFunc* pluginCreateFunc = nullptr;@@ -232,10 +232,9 @@ private:bool is_hidden_device(const std::string& device_name) const;void register_plugin_in_registry_unsafe(const std::string& device_name, PluginDescriptor& desc);- template <typename C, typename = ov::util::enableIfSupportedChar<C>>- void try_to_register_plugin_extensions(const std::basic_string<C>& path) const {+ void try_to_register_plugin_extensions(const ov::util::Path& path) const {try {- auto plugin_extensions = ov::detail::load_extensions(path);+ auto plugin_extensions = ov::detail::load_extensions(path.native());add_extensions_unsafe(plugin_extensions);} catch (const std::runtime_error&) {// in case of shared library is not openeddiff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/cache.cppindex 646d027da6a..d94d4d3dbeb 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/cache.cpp@@ -21,10 +21,10 @@ bool ICache::serialize_model(const std::pair<std::shared_ptr<ov::Model>, ov::conov::conformance::MetaInfo meta = graph_info.second;std::string model_name = model->get_friendly_name();- std::string abs_searilization_dir = ov::util::path_join({ m_serialization_dir, rel_serialization_dir });- std::string xml_path = ov::util::path_join({ abs_searilization_dir, model_name + ".xml" });- std::string bin_path = ov::util::path_join({ abs_searilization_dir, model_name + ".bin" });- std::string meta_path = ov::util::path_join({ abs_searilization_dir, model_name + ".meta" });+ std::string abs_searilization_dir = ov::util::path_join({ m_serialization_dir, rel_serialization_dir }).string();+ std::string xml_path = ov::util::path_join({ abs_searilization_dir, model_name + ".xml" }).string();+ std::string bin_path = ov::util::path_join({ abs_searilization_dir, model_name + ".bin" }).string();+ std::string meta_path = ov::util::path_join({ abs_searilization_dir, model_name + ".meta" }).string();if (!ov::util::directory_exists(abs_searilization_dir)) {ov::util::create_directory_recursive(abs_searilization_dir);@@ -54,4 +54,4 @@ bool ICache::serialize_model(const std::pair<std::shared_ptr<ov::Model>, ov::con} // namespace subgraph_dumper} // namespace tools-} // namespace ov\ No newline at end of file+} // namespace ovdiff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/graph_cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/graph_cache.cppindex c7a1a56b9d9..a3ca42b2cdf 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/graph_cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/graph_cache.cpp@@ -83,7 +83,7 @@ void GraphCache::update_cache(const std::shared_ptr<ov::Model>& extracted_model,if (model_to_update == nullptr) {std::string serialized_model_path = "";for (const auto& extractor : m_manager.get_extractors()) {- auto tmp_serialized_model_path = ov::util::path_join({ m_serialization_dir, m_cache_subdir, extractor.first, graph_name + ".xml" });+ auto tmp_serialized_model_path = ov::util::path_join({ m_serialization_dir, m_cache_subdir, extractor.first, graph_name + ".xml" }).string();if (ov::util::file_exists(tmp_serialized_model_path)) {serialized_model_path = tmp_serialized_model_path;break;@@ -194,7 +194,7 @@ void GraphCache::serialize_cache() {auto cache_item = m_graph_cache.begin();auto rel_dir = ov::util::path_join({ m_cache_subdir,ov::util::get_model_type(cache_item->first),- cache_item->second.get_any_extractor() });+ cache_item->second.get_any_extractor() }).string();serialize_model(*cache_item, rel_dir);m_graph_cache.erase(cache_item);}diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/op_cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/op_cache.cppindex e31502f3d98..4b64519067c 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/op_cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/cache/op_cache.cpp@@ -135,7 +135,7 @@ OpCache::serialize_op(const std::pair<std::shared_ptr<ov::Node>, ov::conformancestd::string OpCache::get_rel_serilization_dir(const std::shared_ptr<ov::Node>& node) {std::string op_folder_name = ov::util::get_node_version(node->get_type_info());auto op_el_type = node->get_output_element_type(0).get_type_name();- return ov::util::path_join({m_cache_subdir, ov::util::get_node_type(node), op_folder_name, op_el_type});+ return ov::util::path_join({m_cache_subdir, ov::util::get_node_type(node), op_folder_name, op_el_type}).string();}} // namespace subgraph_dumperdiff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cppindex 741b78b8b3d..e017690e896 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp@@ -76,7 +76,7 @@ int main(int argc, char *argv[]) {if (!FLAGS_local_cache.empty()) {std::vector<std::string> tmp_paths;for (auto& dir : local_cache_dirs) {- tmp_paths.push_back(ov::util::path_join({dir, cache->m_cache_subdir}));+ tmp_paths.push_back(ov::util::path_join({dir, cache->m_cache_subdir}).string());}auto cached_ops = ov::util::find_models(tmp_paths, FLAGS_path_regex);auto this_cache_model_status = ov::util::cache_models(cache, cached_ops.first, FLAGS_extract_body, true);diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/cache.cppindex 94e6a0935a4..2aa62b49577 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/cache.cpp@@ -15,12 +15,12 @@ namespace util {void save_model_status_to_file(const std::map<ModelCacheStatus, std::vector<std::string>>& caching_status,const std::string& output_dir) {- std::string cache_status_path = ov::util::path_join({output_dir, "model_caching_status"});+ std::string cache_status_path = ov::util::path_join({output_dir, "model_caching_status"}).string();if (!ov::util::directory_exists(cache_status_path)) {ov::util::create_directory_recursive(cache_status_path);}for (const auto& status_info : caching_status) {- std::string output_file_path = ov::util::path_join({ cache_status_path, model_cache_status_to_str[status_info.first] + LST_EXTENSION});+ std::string output_file_path = ov::util::path_join({ cache_status_path, model_cache_status_to_str[status_info.first] + LST_EXTENSION}).string();vector_to_file(status_info.second, output_file_path);}}@@ -119,4 +119,4 @@ std::map<ModelCacheStatus, std::vector<std::string>> cache_models(}} // namespace util-} // namespace ov\ No newline at end of file+} // namespace ovdiff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/cache.cppindex 624c0d32f94..3e0efe24fbd 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/cache.cpp@@ -32,7 +32,7 @@ protected:SubgraphsDumperBaseTest::SetUp();model_name = "test_model";test_artifacts_dir = "test_artifacts";- test_model_path = ov::util::path_join({ test_artifacts_dir, model_name + ".xml" });+ test_model_path = ov::util::path_join({ test_artifacts_dir, model_name + ".xml" }).string();ov::util::create_directory_recursive(test_artifacts_dir);{auto params = ov::ParameterVector {@@ -112,4 +112,4 @@ TEST_F(ICacheUnitTest, is_model_large_to_store_const) {ASSERT_FALSE(this->is_model_large_to_store_const(test_model));}-} // namespace\ No newline at end of file+} // namespacediff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/graph_cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/graph_cache.cppindex ae04d32f9a3..f81554773b8 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/graph_cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/graph_cache.cpp@@ -33,8 +33,8 @@ protected:void SetUp() override {SubgraphsDumperBaseTest::SetUp();test_model_name = "test_model_name";- test_artifacts_dir = ov::util::path_join({ov::test::utils::getCurrentWorkingDir(), "test_artifacts"});- test_model_path = ov::util::path_join({test_artifacts_dir, test_model_name + ".xml"});+ test_artifacts_dir = ov::util::path_join({ov::test::utils::getCurrentWorkingDir(), "test_artifacts"}).string();+ test_model_path = ov::util::path_join({test_artifacts_dir, test_model_name + ".xml"}).string();ov::util::create_directory_recursive(test_artifacts_dir);{Model_0 test;diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/meta.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/meta.cppindex e8a9a953767..467a9041adc 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/meta.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/meta.cpp@@ -86,7 +86,7 @@ protected:test_model_name = ov::util::replace_extension(test_model_path, "");test_in_info = {{ "test_in_0", InputInfo({10}, DEFAULT_MIN_VALUE, 1, true) }};test_model_info = {{ test_model_name, ModelInfo(test_model_path, 5) }};- test_artifacts_dir = ov::util::path_join({ov::test::utils::getCurrentWorkingDir(), "test_artifacts"});+ test_artifacts_dir = ov::util::path_join({ov::test::utils::getCurrentWorkingDir(), "test_artifacts"}).string();ov::util::create_directory_recursive(test_artifacts_dir);}@@ -129,7 +129,7 @@ TEST_F(MetaInfoFuncTest, update) {ASSERT_EQ(test_meta.get_input_info().at("test_in_0").max_shape, ov::PartialShape({10}));std::map<std::string, InputInfo> test_input_info_1 = {{ "test_in_0", InputInfo({50}, 0, 1, true) }};std::string test_model_1 = "test_model_1";- std::string test_model_path_1 = ov::util::path_join({ "path", "to", test_model_1 + ".xml"});+ std::string test_model_path_1 = ov::util::path_join({ "path", "to", test_model_1 + ".xml"}).string();ASSERT_ANY_THROW(test_meta.update(test_model_path_1, {}));ASSERT_ANY_THROW(test_meta.update(test_model_path_1, {{ "test_in_1", InputInfo({10}) }}));ASSERT_ANY_THROW(test_meta.update(test_model_path_1, {{ "test_in_0", InputInfo({10}, 0, 1, false) }}));@@ -143,7 +143,7 @@ TEST_F(MetaInfoFuncTest, update) {TEST_F(MetaInfoFuncTest, serialize) {auto test_meta = MetaInfo(test_model_name, test_in_info);- std::string seriliazation_path(ov::util::path_join({test_artifacts_dir, "test_meta.meta"}));+ std::string seriliazation_path(ov::util::path_join({test_artifacts_dir, "test_meta.meta"}).string());test_meta.serialize(seriliazation_path);ASSERT_TRUE(ov::util::file_exists(seriliazation_path));}@@ -161,7 +161,7 @@ protected:};TEST_F(MetaInfoUnitTest, serialize) {- std::string seriliazation_path(ov::util::path_join({test_artifacts_dir, "test_meta.meta"}));+ std::string seriliazation_path(ov::util::path_join({test_artifacts_dir, "test_meta.meta"}).string());this->extractors = { "extractor_0", "extractor_1" };this->serialize(seriliazation_path);ASSERT_TRUE(ov::util::file_exists(seriliazation_path));@@ -215,7 +215,7 @@ TEST_F(MetaInfoUnitTest, serialize) {}TEST_F(MetaInfoUnitTest, read_meta_from_file) {- std::string seriliazation_path(ov::util::path_join({test_artifacts_dir, "test_meta.meta"}));+ std::string seriliazation_path(ov::util::path_join({test_artifacts_dir, "test_meta.meta"}).string());this->extractors = { "extractor_0", "extractor_1" };this->serialize(seriliazation_path);auto new_meta = MetaInfo::read_meta_from_file(seriliazation_path);@@ -228,7 +228,7 @@ TEST_F(MetaInfoUnitTest, update) {auto test_meta = MetaInfo(test_model_name, test_in_info);std::map<std::string, InputInfo> test_meta_1 = {{ "test_in_0", InputInfo({20}, 0, 1, true) }};std::string test_model_1 = "test_model_1";- std::string test_model_path_1 = ov::util::path_join({ "path", "to", test_model_1 + ".xml"});+ std::string test_model_path_1 = ov::util::path_join({ "path", "to", test_model_1 + ".xml"}).string();OV_ASSERT_NO_THROW(this->update(test_model_path_1, test_meta_1));ASSERT_NE(this->model_info.find(test_model_1), this->model_info.end());ASSERT_EQ(*this->model_info[test_model_1].model_paths.begin(), test_model_path_1);@@ -240,7 +240,7 @@ TEST_F(MetaInfoUnitTest, update) {ASSERT_EQ(this->model_info[test_model_1].this_op_cnt, 2);ASSERT_EQ(this->input_info.begin()->second.min_shape, ov::PartialShape({10}));ASSERT_EQ(this->input_info.begin()->second.max_shape, ov::PartialShape({20}));- test_model_path_1 = ov::util::path_join({ "path", "to", "test", test_model_1 + ".xml"});+ test_model_path_1 = ov::util::path_join({ "path", "to", "test", test_model_1 + ".xml"}).string();OV_ASSERT_NO_THROW(this->update(test_model_path_1, test_meta_1, 0, 1, "test_extractor"));ASSERT_EQ(this->model_info[test_model_1].model_paths.size(), 2);ASSERT_EQ(this->model_info[test_model_1].this_op_cnt, 3);@@ -268,4 +268,4 @@ TEST_F(MetaInfoUnitTest, get_any_extractor) {ASSERT_EQ(meta.get_any_extractor(), "test_extractor");}-} // namespace\ No newline at end of file+} // namespacediff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/op_cache.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/op_cache.cppindex 7d8c1743b2c..4d7870595ff 100644--- a/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/op_cache.cpp+++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/tests/cache/op_cache.cpp@@ -2,19 +2,17 @@// SPDX-License-Identifier: Apache-2.0//-#include <memory>+#include "cache/op_cache.hpp"-#include "openvino/op/ops.hpp"-#include "openvino/util/file_util.hpp"+#include <memory>+#include "base_test.hpp"#include "common_test_utils/file_utils.hpp"#include "common_test_utils/graph_comparator.hpp"--#include "cache/op_cache.hpp"-#include "utils/node.hpp"+#include "openvino/op/ops.hpp"+#include "openvino/util/file_util.hpp"#include "utils/cache.hpp"--#include "base_test.hpp"+#include "utils/node.hpp"namespace {@@ -30,11 +28,11 @@ protected:void SetUp() override {SubgraphsDumperBaseTest::SetUp();test_model_name = "test_model_name";- test_artifacts_dir = ov::util::path_join({ov::test::utils::getCurrentWorkingDir(), "test_artifacts"});- test_model_path = ov::util::path_join({test_artifacts_dir, test_model_name + ".xml"});+ test_artifacts_dir = ov::util::path_join({ov::test::utils::getCurrentWorkingDir(), "test_artifacts"}).string();+ test_model_path = ov::util::path_join({test_artifacts_dir, test_model_name + ".xml"}).string();ov::util::create_directory_recursive(test_artifacts_dir);{- auto params = ov::ParameterVector {+ auto params = ov::ParameterVector{std::make_shared<ov::op::v0::Parameter>(ov::element::Type_t::f32, ov::PartialShape{1, 1, 1, 1}),};auto convert = std::make_shared<ov::op::v0::Convert>(params.front(), ov::element::f16);@@ -77,8 +75,7 @@ TEST_F(OpCacheFuncTest, serialize_cache) {// ====================== Operation Cache Unit tests ==============================-class OpCacheUnitTest : public OpCacheFuncTest,- public virtual OpCache {+class OpCacheUnitTest : public OpCacheFuncTest, public virtual OpCache {protected:std::shared_ptr<ov::op::v0::Convert> convert_node;ov::conformance::MetaInfo test_meta;@@ -101,7 +98,7 @@ TEST_F(OpCacheUnitTest, update_cache_by_model) {this->update_cache(convert_node, test_model_path, 1);ASSERT_EQ(m_ops_cache.size(), 1);std::shared_ptr<ov::Model> test_model_1;- std::string test_model_path_1 = ov::util::path_join({test_artifacts_dir, "model_1", test_model_name + ".xml"});+ std::string test_model_path_1 = ov::util::path_join({test_artifacts_dir, "model_1", test_model_name + ".xml"}).string();{auto param = std::make_shared<ov::op::v0::Parameter>(ov::element::Type_t::f32, ov::PartialShape{1, 1, 1, 1});param->set_friendly_name("in_0");@@ -158,6 +155,11 @@ TEST_F(OpCacheUnitTest, update_cache_by_model) {}}+TEST_F(OpCacheUnitTest, directory_exists) {+ EXPECT_TRUE(ov::util::directory_exists(test_artifacts_dir));+ EXPECT_FALSE(ov::util::directory_exists(test_artifacts_dir + "/fake"));+}+TEST_F(OpCacheUnitTest, serialize_op) {// Ticket: 149824if (std::getenv("GITHUB_ACTIONS")) {@@ -166,8 +168,8 @@ TEST_F(OpCacheUnitTest, serialize_op) {this->set_serialization_dir(test_artifacts_dir);ASSERT_TRUE(this->serialize_op({convert_node, test_meta}));ASSERT_TRUE(ov::util::directory_exists(test_artifacts_dir));- auto serialized_model_path = ov::util::path_join({test_artifacts_dir,- "operation", "static", "Convert-1", "f16", "Convert-1_0.xml"});+ auto serialized_model_path =+ ov::util::path_join({test_artifacts_dir, "operation", "static", "Convert-1", "f16", "Convert-1_0.xml"});ASSERT_TRUE(ov::util::file_exists(serialized_model_path));auto serialized_model = ov::util::core->read_model(serialized_model_path);auto res = compare_functions(test_model, serialized_model, true, false, true, true, true, false);diff --git a/src/tests/test_utils/common_test_utils/src/file_utils.cpp b/src/tests/test_utils/common_test_utils/src/file_utils.cppindex 83d3283f2cb..71ba9dadcae 100644--- a/src/tests/test_utils/common_test_utils/src/file_utils.cpp+++ b/src/tests/test_utils/common_test_utils/src/file_utils.cpp@@ -123,7 +123,7 @@ std::string getExecutableDirectory() {throw "Can't get test executable path name";}path = std::string(buffer, len);- return ov::util::get_directory(path);+ return ov::util::get_directory(path).string();}std::string getCurrentWorkingDir() {@@ -150,7 +150,7 @@ std::string getCurrentWorkingDir() {}std::string getModelFromTestModelZoo(const std::string& relModelPath) {- return ov::util::path_join({getExecutableDirectory(), relModelPath});+ return ov::util::path_join({getExecutableDirectory(), relModelPath}).string();}std::string getRelativePath(const std::string& from, const std::string& to) {