Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[core ] Remove ov::util::Path alias (#32883)

Pawel Raasz5cda7b61e0f2
diff --git a/src/common/util/include/openvino/util/file_path.hpp b/src/common/util/include/openvino/util/file_path.hpp
index 680f5de8f09..d738ac707fa 100644
--- a/src/common/util/include/openvino/util/file_path.hpp
+++ b/src/common/util/include/openvino/util/file_path.hpp
@@ -13,8 +13,6 @@ namespace ov::util {
// * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95048
// * https://stackoverflow.com/questions/58521857/cross-platform-way-to-handle-stdstring-stdwstring-with-stdfilesystempath
// Working compiler versions has been designated with godbolt.
-using Path = std::filesystem::path;
-
#if !defined(__GNUC__) || (__GNUC__ > 12 || __GNUC__ == 12 && __GNUC_MINOR__ >= 3)
# define GCC_NOT_USED_OR_VER_AT_LEAST_12_3
#endif
@@ -36,6 +34,6 @@ using Path = std::filesystem::path;
#if defined(GCC_VER_LESS_THAN_12_3) || defined(CLANG_VER_LESS_THAN_17)
template <>
-ov::util::Path::path(const std::wstring& source, ov::util::Path::format fmt);
+std::filesystem::path::path(const std::wstring& source, std::filesystem::path::format fmt);
#endif
diff --git a/src/common/util/include/openvino/util/file_util.hpp b/src/common/util/include/openvino/util/file_util.hpp
index bfb60e8a126..e6fa58dc8c0 100644
--- a/src/common/util/include/openvino/util/file_util.hpp
+++ b/src/common/util/include/openvino/util/file_util.hpp
@@ -151,7 +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 ov::util::Path& path);
+bool directory_exists(const std::filesystem::path& path);
/**
* @brief Returns file size for file
@@ -159,7 +159,7 @@ bool directory_exists(const ov::util::Path& path);
* @return file size
*/
-inline int64_t file_size(const ov::util::Path& path) {
+inline int64_t file_size(const std::filesystem::path& path) {
std::error_code ec;
const auto size = std::filesystem::file_size(path, ec);
return ec ? -1 : static_cast<int64_t>(size);
@@ -215,9 +215,9 @@ inline bool file_exists(const std::string& path) {
}
std::string get_file_ext(const std::string& path);
-ov::util::Path get_directory(const ov::util::Path& path);
+std::filesystem::path get_directory(const std::filesystem::path& path);
-ov::util::Path path_join(std::initializer_list<ov::util::Path>&& paths);
+std::filesystem::path path_join(std::initializer_list<std::filesystem::path>&& paths);
std::wstring path_join_w(std::initializer_list<std::wstring>&& paths);
void iterate_files(const std::string& path,
@@ -230,15 +230,15 @@ void convert_path_win_style(std::string& path);
std::string get_ov_lib_path();
// TODO: remove this using. replace with Path.
-using FilePath = ov::util::Path::string_type;
+using FilePath = std::filesystem::path::string_type;
// TODO: remove this function after get_plugin_path using Path
-inline std::string from_file_path(const ov::util::Path& path) {
+inline std::string from_file_path(const std::filesystem::path& path) {
return path.string();
}
// TODO: remove this function after all calls use Path
-inline FilePath to_file_path(const ov::util::Path& path) {
+inline FilePath to_file_path(const std::filesystem::path& path) {
#if defined(_WIN32) && defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
return ov::util::string_to_wstring(path.string());
#else
diff --git a/src/common/util/src/file_path.cpp b/src/common/util/src/file_path.cpp
index 8a0d8154dfb..b960c37cb86 100644
--- a/src/common/util/src/file_path.cpp
+++ b/src/common/util/src/file_path.cpp
@@ -9,7 +9,7 @@
#if defined(GCC_VER_LESS_THAN_12_3) || defined(CLANG_VER_LESS_THAN_17)
template <>
-ov::util::Path::path(const std::wstring& source, ov::util::Path::format fmt)
+std::filesystem::path::path(const std::wstring& source, std::filesystem::path::format fmt)
: path(ov::util::wstring_to_string(source), fmt) {}
#endif
diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp
index 22dd2daf3ca..806822f512d 100644
--- a/src/common/util/src/file_util.cpp
+++ b/src/common/util/src/file_util.cpp
@@ -91,7 +91,7 @@ std::string ov::util::get_file_ext(const std::string& s) {
return rc;
}
-ov::util::Path ov::util::get_directory(const ov::util::Path& path) {
+std::filesystem::path ov::util::get_directory(const std::filesystem::path& path) {
if (path.empty()) {
return {};
} else if (const auto& parent_path = path.parent_path(); parent_path.empty()) {
@@ -101,9 +101,9 @@ ov::util::Path ov::util::get_directory(const ov::util::Path& path) {
}
}
-template <class Container = std::initializer_list<ov::util::Path>>
-ov::util::Path path_join(Container&& paths) {
- ov::util::Path joined_path{};
+template <class Container = std::initializer_list<std::filesystem::path>>
+std::filesystem::path path_join(Container&& paths) {
+ std::filesystem::path joined_path{};
for (auto&& path : paths) {
if (!path.empty()) {
@@ -114,7 +114,7 @@ ov::util::Path path_join(Container&& paths) {
}
// TODO: Remove string() / wstring() casts on function call site
-ov::util::Path ov::util::path_join(std::initializer_list<ov::util::Path>&& paths) {
+std::filesystem::path ov::util::path_join(std::initializer_list<std::filesystem::path>&& paths) {
return ::path_join<>(std::move(paths));
}
@@ -312,7 +312,7 @@ void ov::util::create_directory_recursive(const std::filesystem::path& path) {
}
}
-bool ov::util::directory_exists(const ov::util::Path& path) {
+bool ov::util::directory_exists(const std::filesystem::path& path) {
return std::filesystem::is_directory(std::filesystem::status(path));
}
diff --git a/src/inference/src/cache_manager.hpp b/src/inference/src/cache_manager.hpp
index 34cc5254163..b6fd78175e0 100644
--- a/src/inference/src/cache_manager.hpp
+++ b/src/inference/src/cache_manager.hpp
@@ -110,7 +110,7 @@ public:
class FileStorageCacheManager final : public ICacheManager {
std::string m_cachePath;
- ov::util::Path getBlobFile(const std::string& blobHash) const {
+ std::filesystem::path getBlobFile(const std::string& blobHash) const {
#if defined(_WIN32) && defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
return ov::util::string_to_wstring(ov::util::make_path(m_cachePath, blobHash + ".blob"));
#else
diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp
index a386b2c1713..baebf70fdd2 100644
--- a/src/inference/src/dev/core_impl.cpp
+++ b/src/inference/src/dev/core_impl.cpp
@@ -212,7 +212,7 @@ static const auto core_properties_names =
static const auto auto_batch_properties_names =
ov::util::make_array(ov::auto_batch_timeout.name(), ov::hint::allow_auto_batching.name());
-ov::util::Path extract_weight_path(const std::string& compiled_properties) {
+std::filesystem::path extract_weight_path(const std::string& compiled_properties) {
if (auto start = compiled_properties.find(ov::weights_path.name()); start != std::string::npos) {
start += std::string_view{ov::weights_path.name()}.size() + 1;
auto length = compiled_properties.find(",", start);
@@ -257,7 +257,7 @@ ov::SoPtr<ov::ICompiledModel> import_compiled_model(const ov::Plugin& plugin,
[&cfg, &plugin](const std::string& model_path) {
if (cfg.count(ov::weights_path.name()) == 0 &&
ov::util::contains(plugin.get_property(ov::supported_properties), ov::weights_path)) {
- ov::util::Path weights_path{model_path};
+ std::filesystem::path weights_path{model_path};
weights_path.replace_extension(".bin");
if (ov::util::file_exists(weights_path)) {
cfg[ov::weights_path.name()] = weights_path.string();
@@ -1569,7 +1569,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(
}
if (util::contains(plugin.get_property(ov::supported_properties), ov::weights_path)) {
- util::Path weights_path;
+ std::filesystem::path weights_path;
if (auto&& path_hint = update_config.find(ov::weights_path.name());
path_hint != update_config.end()) {
diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp
index 3a3cd9b1841..588877378a1 100644
--- a/src/inference/src/dev/core_impl.hpp
+++ b/src/inference/src/dev/core_impl.hpp
@@ -167,7 +167,7 @@ private:
mutable ov::CacheGuard m_cache_guard;
struct PluginDescriptor {
- ov::util::Path m_lib_location{};
+ std::filesystem::path m_lib_location{};
ov::AnyMap m_default_config{};
std::vector<ov::util::FilePath> m_list_of_extensions{};
CreatePluginEngineFunc* m_plugin_create_func = nullptr;
diff --git a/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp b/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp
index be413e1daa3..d62f226c63e 100644
--- a/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp
+++ b/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp
@@ -1173,7 +1173,7 @@ TEST_P(OVCompiledModelBaseTest, use_blob_hint_which_fails_load_from_cache) {
}
TEST_P(OVCompiledModelBaseTest, compile_from_cached_weightless_blob_but_no_weights) {
- auto cache_dir = ov::util::Path(utils::getCurrentWorkingDir()) / (utils::generateTestFilePrefix() + "cache");
+ auto cache_dir = std::filesystem::path(utils::getCurrentWorkingDir()) / (utils::generateTestFilePrefix() + "cache");
auto w_file_path = cache_dir / "weights.bin";
std::filesystem::create_directories(cache_dir);
diff --git a/src/tests/test_utils/common_test_utils/tests/file_util_test.cpp b/src/tests/test_utils/common_test_utils/tests/file_util_test.cpp
index 1119318f060..8851473099a 100644
--- a/src/tests/test_utils/common_test_utils/tests/file_util_test.cpp
+++ b/src/tests/test_utils/common_test_utils/tests/file_util_test.cpp
@@ -14,7 +14,6 @@
#include "common_test_utils/common_utils.hpp"
#include "common_test_utils/file_utils.hpp"
#include "openvino/core/visibility.hpp"
-#include "openvino/util/file_path.hpp"
#include "openvino/util/file_util.hpp"
namespace ov::test {
@@ -176,155 +175,155 @@ TEST_F(TrimFileTest, relatice_path_to_source_forward_slash_always_supported) {
TEST(file_util, path_cast) {
// from char to char
- EXPECT_STREQ("", ov::util::Path("").string().c_str());
- EXPECT_STREQ("file.txt", ov::util::Path("file.txt").string().c_str());
- EXPECT_STREQ("./local/file.txt", ov::util::Path("./local/file.txt").generic_string().c_str());
- EXPECT_STREQ("~/local/file.txt", ov::util::Path("~/local/file.txt").generic_string().c_str());
- EXPECT_STREQ("/usr/local/file.txt", ov::util::Path("/usr/local/file.txt").generic_string().c_str());
- EXPECT_STREQ("C:\\Users\\file.txt", ov::util::Path("C:\\Users\\file.txt").string().c_str());
+ EXPECT_STREQ("", std::filesystem::path("").string().c_str());
+ EXPECT_STREQ("file.txt", std::filesystem::path("file.txt").string().c_str());
+ EXPECT_STREQ("./local/file.txt", std::filesystem::path("./local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("~/local/file.txt", std::filesystem::path("~/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("/usr/local/file.txt", std::filesystem::path("/usr/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("C:\\Users\\file.txt", std::filesystem::path("C:\\Users\\file.txt").string().c_str());
// from char8_t to char
- EXPECT_STREQ("", ov::util::Path(u8"").string().c_str());
- EXPECT_STREQ("file.txt", ov::util::Path(u8"file.txt").string().c_str());
- EXPECT_STREQ("./local/file.txt", ov::util::Path(u8"./local/file.txt").generic_string().c_str());
- EXPECT_STREQ("~/local/file.txt", ov::util::Path(u8"~/local/file.txt").generic_string().c_str());
- EXPECT_STREQ("/usr/local/file.txt", ov::util::Path(u8"/usr/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("", std::filesystem::path(u8"").string().c_str());
+ EXPECT_STREQ("file.txt", std::filesystem::path(u8"file.txt").string().c_str());
+ EXPECT_STREQ("./local/file.txt", std::filesystem::path(u8"./local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("~/local/file.txt", std::filesystem::path(u8"~/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("/usr/local/file.txt", std::filesystem::path(u8"/usr/local/file.txt").generic_string().c_str());
// from char16_t to char
- EXPECT_STREQ("", ov::util::Path(u"").string().c_str());
- EXPECT_STREQ("file.txt", ov::util::Path(u"file.txt").string().c_str());
- EXPECT_STREQ("./local/file.txt", ov::util::Path(u"./local/file.txt").generic_string().c_str());
- EXPECT_STREQ("~/local/file.txt", ov::util::Path(u"~/local/file.txt").generic_string().c_str());
- EXPECT_STREQ("/usr/local/file.txt", ov::util::Path(u"/usr/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("", std::filesystem::path(u"").string().c_str());
+ EXPECT_STREQ("file.txt", std::filesystem::path(u"file.txt").string().c_str());
+ EXPECT_STREQ("./local/file.txt", std::filesystem::path(u"./local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("~/local/file.txt", std::filesystem::path(u"~/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("/usr/local/file.txt", std::filesystem::path(u"/usr/local/file.txt").generic_string().c_str());
// from char32_t to char
- EXPECT_STREQ("", ov::util::Path(U"").string().c_str());
- EXPECT_STREQ("file.txt", ov::util::Path(U"file.txt").string().c_str());
- EXPECT_STREQ("./local/file.txt", ov::util::Path(U"./local/file.txt").generic_string().c_str());
- EXPECT_STREQ("~/local/file.txt", ov::util::Path(U"~/local/file.txt").generic_string().c_str());
- EXPECT_STREQ("/usr/local/file.txt", ov::util::Path(U"/usr/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("", std::filesystem::path(U"").string().c_str());
+ EXPECT_STREQ("file.txt", std::filesystem::path(U"file.txt").string().c_str());
+ EXPECT_STREQ("./local/file.txt", std::filesystem::path(U"./local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("~/local/file.txt", std::filesystem::path(U"~/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("/usr/local/file.txt", std::filesystem::path(U"/usr/local/file.txt").generic_string().c_str());
// from char to wchar_t
- EXPECT_STREQ(L"", ov::util::Path("").wstring().c_str());
- EXPECT_STREQ(L"file.txt", ov::util::Path("file.txt").wstring().c_str());
- EXPECT_STREQ(L"./local/file.txt", ov::util::Path("./local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"~/local/file.txt", ov::util::Path("~/local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"/usr/local/file.txt", ov::util::Path("/usr/local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"C:\\Users\\file.txt", ov::util::Path("C:\\Users\\file.txt").wstring().c_str());
+ EXPECT_STREQ(L"", std::filesystem::path("").wstring().c_str());
+ EXPECT_STREQ(L"file.txt", std::filesystem::path("file.txt").wstring().c_str());
+ EXPECT_STREQ(L"./local/file.txt", std::filesystem::path("./local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"~/local/file.txt", std::filesystem::path("~/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"/usr/local/file.txt", std::filesystem::path("/usr/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"C:\\Users\\file.txt", std::filesystem::path("C:\\Users\\file.txt").wstring().c_str());
// from char8_t to wchar_t
- EXPECT_STREQ(L"", ov::util::Path(u8"").wstring().c_str());
- EXPECT_STREQ(L"file.txt", ov::util::Path(u8"file.txt").wstring().c_str());
- EXPECT_STREQ(L"./local/file.txt", ov::util::Path(u8"./local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"~/local/file.txt", ov::util::Path(u8"~/local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"/usr/local/file.txt", ov::util::Path(u8"/usr/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"", std::filesystem::path(u8"").wstring().c_str());
+ EXPECT_STREQ(L"file.txt", std::filesystem::path(u8"file.txt").wstring().c_str());
+ EXPECT_STREQ(L"./local/file.txt", std::filesystem::path(u8"./local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"~/local/file.txt", std::filesystem::path(u8"~/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"/usr/local/file.txt", std::filesystem::path(u8"/usr/local/file.txt").generic_wstring().c_str());
// from char16_t to wchar_t
- EXPECT_STREQ(L"", ov::util::Path(u"").wstring().c_str());
- EXPECT_STREQ(L"file.txt", ov::util::Path(u"file.txt").wstring().c_str());
- EXPECT_STREQ(L"./local/file.txt", ov::util::Path(u"./local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"~/local/file.txt", ov::util::Path(u"~/local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"/usr/local/file.txt", ov::util::Path(u"/usr/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"", std::filesystem::path(u"").wstring().c_str());
+ EXPECT_STREQ(L"file.txt", std::filesystem::path(u"file.txt").wstring().c_str());
+ EXPECT_STREQ(L"./local/file.txt", std::filesystem::path(u"./local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"~/local/file.txt", std::filesystem::path(u"~/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"/usr/local/file.txt", std::filesystem::path(u"/usr/local/file.txt").generic_wstring().c_str());
// from char32_t to wchar_t
- EXPECT_STREQ(L"", ov::util::Path(U"").wstring().c_str());
- EXPECT_STREQ(L"file.txt", ov::util::Path(U"file.txt").wstring().c_str());
- EXPECT_STREQ(L"./local/file.txt", ov::util::Path(U"./local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"~/local/file.txt", ov::util::Path(U"~/local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"/usr/local/file.txt", ov::util::Path(U"/usr/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"", std::filesystem::path(U"").wstring().c_str());
+ EXPECT_STREQ(L"file.txt", std::filesystem::path(U"file.txt").wstring().c_str());
+ EXPECT_STREQ(L"./local/file.txt", std::filesystem::path(U"./local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"~/local/file.txt", std::filesystem::path(U"~/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"/usr/local/file.txt", std::filesystem::path(U"/usr/local/file.txt").generic_wstring().c_str());
// from char to u16string
- EXPECT_TRUE(std::u16string(u"") == ov::util::Path("").u16string());
- EXPECT_TRUE(std::u16string(u"file.txt") == ov::util::Path("file.txt").u16string());
- EXPECT_TRUE(std::u16string(u"./local/file.txt") == ov::util::Path("./local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"~/local/file.txt") == ov::util::Path("~/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == ov::util::Path("/usr/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == ov::util::Path("C:\\Users\\file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"") == std::filesystem::path("").u16string());
+ EXPECT_TRUE(std::u16string(u"file.txt") == std::filesystem::path("file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"./local/file.txt") == std::filesystem::path("./local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"~/local/file.txt") == std::filesystem::path("~/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == std::filesystem::path("/usr/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == std::filesystem::path("C:\\Users\\file.txt").u16string());
// from char8_t to u16string
- EXPECT_TRUE(std::u16string(u"") == ov::util::Path(u8"").u16string());
- EXPECT_TRUE(std::u16string(u"file.txt") == ov::util::Path(u8"file.txt").u16string());
- EXPECT_TRUE(std::u16string(u"./local/file.txt") == ov::util::Path(u8"./local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"~/local/file.txt") == ov::util::Path(u8"~/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == ov::util::Path(u8"/usr/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == ov::util::Path(u8"C:\\Users\\file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"") == std::filesystem::path(u8"").u16string());
+ EXPECT_TRUE(std::u16string(u"file.txt") == std::filesystem::path(u8"file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"./local/file.txt") == std::filesystem::path(u8"./local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"~/local/file.txt") == std::filesystem::path(u8"~/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == std::filesystem::path(u8"/usr/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == std::filesystem::path(u8"C:\\Users\\file.txt").u16string());
// from char16_t to u16string
- EXPECT_TRUE(std::u16string(u"") == ov::util::Path(u"").u16string());
- EXPECT_TRUE(std::u16string(u"file.txt") == ov::util::Path(u"file.txt").u16string());
- EXPECT_TRUE(std::u16string(u"./local/file.txt") == ov::util::Path(u"./local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"~/local/file.txt") == ov::util::Path(u"~/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == ov::util::Path(u"/usr/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == ov::util::Path(u"C:\\Users\\file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"") == std::filesystem::path(u"").u16string());
+ EXPECT_TRUE(std::u16string(u"file.txt") == std::filesystem::path(u"file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"./local/file.txt") == std::filesystem::path(u"./local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"~/local/file.txt") == std::filesystem::path(u"~/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == std::filesystem::path(u"/usr/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == std::filesystem::path(u"C:\\Users\\file.txt").u16string());
// from char32_t to u16string
- EXPECT_TRUE(std::u16string(u"") == ov::util::Path(U"").u16string());
- EXPECT_TRUE(std::u16string(u"file.txt") == ov::util::Path(U"file.txt").u16string());
- EXPECT_TRUE(std::u16string(u"./local/file.txt") == ov::util::Path(U"./local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"~/local/file.txt") == ov::util::Path(U"~/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == ov::util::Path(U"/usr/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == ov::util::Path(U"C:\\Users\\file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"") == std::filesystem::path(U"").u16string());
+ EXPECT_TRUE(std::u16string(u"file.txt") == std::filesystem::path(U"file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"./local/file.txt") == std::filesystem::path(U"./local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"~/local/file.txt") == std::filesystem::path(U"~/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == std::filesystem::path(U"/usr/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"C:\\Users\\file.txt") == std::filesystem::path(U"C:\\Users\\file.txt").u16string());
}
TEST(file_util, path_cast_unicode) {
- EXPECT_EQ("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗1.txt", ov::util::Path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗1.txt").generic_string());
+ EXPECT_EQ("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗1.txt", std::filesystem::path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗1.txt").generic_string());
EXPECT_TRUE(std::u16string(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗6.txt") ==
- ov::util::Path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗6.txt").generic_u16string());
+ std::filesystem::path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗6.txt").generic_u16string());
EXPECT_TRUE(std::u16string(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗7.txt") ==
- ov::util::Path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗7.txt").generic_u16string());
+ std::filesystem::path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗7.txt").generic_u16string());
#if !defined(_MSC_VER) && defined(OPENVINO_CPP_VER_AT_LEAST_20)
EXPECT_TRUE(std::u8string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗9.txt") ==
- ov::util::Path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗9.txt").generic_u8string());
+ std::filesystem::path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗9.txt").generic_u8string());
#endif
#if defined(OPENVINO_CPP_VER_AT_LEAST_20)
EXPECT_TRUE(std::u8string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗10.txt") ==
- ov::util::Path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗10.txt").generic_u8string());
+ std::filesystem::path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗10.txt").generic_u8string());
EXPECT_TRUE(std::u8string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗11.txt") ==
- ov::util::Path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗11.txt").generic_u8string());
+ std::filesystem::path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗11.txt").generic_u8string());
EXPECT_TRUE(std::u8string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗12.txt") ==
- ov::util::Path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗12.txt").generic_u8string());
+ std::filesystem::path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗12.txt").generic_u8string());
#else
EXPECT_EQ(std::string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗14.txt"),
- ov::util::Path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗14.txt").generic_u8string());
+ std::filesystem::path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗14.txt").generic_u8string());
EXPECT_EQ(std::string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗15.txt"),
- ov::util::Path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗15.txt").generic_u8string());
+ std::filesystem::path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗15.txt").generic_u8string());
#endif
#if !defined(_MSC_VER) || defined(_MSC_VER) && defined(OPENVINO_CPP_VER_AT_LEAST_20)
EXPECT_TRUE(std::u16string(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗8.txt") ==
- ov::util::Path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗8.txt").generic_u16string());
+ std::filesystem::path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗8.txt").generic_u16string());
EXPECT_TRUE(std::u32string(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗18.txt") ==
- ov::util::Path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗18.txt").u32string());
+ std::filesystem::path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗18.txt").u32string());
#endif
#if defined(OPENVINO_CPP_VER_AT_LEAST_20) && \
(defined(_MSC_VER) || \
!defined(_MSC_VER) && defined(GCC_NOT_USED_OR_VER_AT_LEAST_12_3) && defined(CLANG_NOT_USED_OR_VER_AT_LEAST_17))
EXPECT_TRUE(std::u8string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗16.txt") ==
- ov::util::Path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗16.txt").generic_u8string());
+ std::filesystem::path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗16.txt").generic_u8string());
EXPECT_TRUE(std::wstring(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗29.txt") ==
- ov::util::Path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗29.txt").wstring());
+ std::filesystem::path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗29.txt").wstring());
#endif
}
#if !defined(_MSC_VER)
TEST(file_util, path_cast_unicode_from_string) {
EXPECT_TRUE(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗13.txt" ==
- ov::util::Path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗13.txt").generic_u8string());
+ std::filesystem::path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗13.txt").generic_u8string());
EXPECT_TRUE(std::u16string(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗5.txt") ==
- ov::util::Path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗5.txt").generic_u16string());
+ std::filesystem::path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗5.txt").generic_u16string());
EXPECT_TRUE(std::u32string(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗21.txt") ==
- ov::util::Path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗21.txt").u32string());
+ std::filesystem::path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗21.txt").u32string());
}
TEST(file_util, path_cast_unicode_to_string) {
EXPECT_EQ(std::string("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗4.txt"),
- ov::util::Path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗4.txt").generic_string());
+ std::filesystem::path(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗4.txt").generic_string());
EXPECT_EQ(std::string("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗2.txt"),
- ov::util::Path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗2.txt").generic_string());
+ std::filesystem::path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗2.txt").generic_string());
EXPECT_EQ(std::string("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗3.txt"),
- ov::util::Path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗3.txt").generic_string());
+ std::filesystem::path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗3.txt").generic_string());
}
#endif
@@ -334,52 +333,52 @@ TEST(file_util, path_cast_unicode_to_string) {
TEST(file_util, path_cast_unicode_from_string_to_wstring) {
EXPECT_TRUE(std::wstring(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗27.txt") ==
- ov::util::Path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗27.txt").generic_wstring());
+ std::filesystem::path("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗27.txt").generic_wstring());
}
TEST(file_util, path_cast_unicode_from_wstring_to_string) {
EXPECT_STREQ("~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗25.txt",
- ov::util::Path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗25.txt").generic_string().c_str());
+ std::filesystem::path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗25.txt").generic_string().c_str());
}
#endif
TEST(file_util, path_cast_to_u32string) {
// from char to u32string
- EXPECT_TRUE(std::u32string(U"") == ov::util::Path("").u32string());
- EXPECT_TRUE(std::u32string(U"file.txt") == ov::util::Path("file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"./local/file.txt") == ov::util::Path("./local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"~/local/file.txt") == ov::util::Path("~/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == ov::util::Path("/usr/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == ov::util::Path("C:\\Users\\file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"") == std::filesystem::path("").u32string());
+ EXPECT_TRUE(std::u32string(U"file.txt") == std::filesystem::path("file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"./local/file.txt") == std::filesystem::path("./local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"~/local/file.txt") == std::filesystem::path("~/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == std::filesystem::path("/usr/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == std::filesystem::path("C:\\Users\\file.txt").u32string());
// from char8_t to u32string
- EXPECT_TRUE(std::u32string(U"") == ov::util::Path(u8"").u32string());
- EXPECT_TRUE(std::u32string(U"file.txt") == ov::util::Path(u8"file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"./local/file.txt") == ov::util::Path(u8"./local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"~/local/file.txt") == ov::util::Path(u8"~/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == ov::util::Path(u8"/usr/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == ov::util::Path(u8"C:\\Users\\file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"") == std::filesystem::path(u8"").u32string());
+ EXPECT_TRUE(std::u32string(U"file.txt") == std::filesystem::path(u8"file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"./local/file.txt") == std::filesystem::path(u8"./local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"~/local/file.txt") == std::filesystem::path(u8"~/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == std::filesystem::path(u8"/usr/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == std::filesystem::path(u8"C:\\Users\\file.txt").u32string());
// from char16_t to u32string
- EXPECT_TRUE(std::u32string(U"") == ov::util::Path(u"").u32string());
- EXPECT_TRUE(std::u32string(U"file.txt") == ov::util::Path(u"file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"./local/file.txt") == ov::util::Path(u"./local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"~/local/file.txt") == ov::util::Path(u"~/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == ov::util::Path(u"/usr/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == ov::util::Path(u"C:\\Users\\file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"") == std::filesystem::path(u"").u32string());
+ EXPECT_TRUE(std::u32string(U"file.txt") == std::filesystem::path(u"file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"./local/file.txt") == std::filesystem::path(u"./local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"~/local/file.txt") == std::filesystem::path(u"~/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == std::filesystem::path(u"/usr/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == std::filesystem::path(u"C:\\Users\\file.txt").u32string());
// from char32_t to u32string
- EXPECT_TRUE(std::u32string(U"") == ov::util::Path(U"").u32string());
- EXPECT_TRUE(std::u32string(U"file.txt") == ov::util::Path(U"file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"./local/file.txt") == ov::util::Path(U"./local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"~/local/file.txt") == ov::util::Path(U"~/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == ov::util::Path(U"/usr/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == ov::util::Path(U"C:\\Users\\file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"") == std::filesystem::path(U"").u32string());
+ EXPECT_TRUE(std::u32string(U"file.txt") == std::filesystem::path(U"file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"./local/file.txt") == std::filesystem::path(U"./local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"~/local/file.txt") == std::filesystem::path(U"~/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == std::filesystem::path(U"/usr/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"C:\\Users\\file.txt") == std::filesystem::path(U"C:\\Users\\file.txt").u32string());
// from char16_t, char32_t to u32string
EXPECT_TRUE(std::u32string(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗23.txt") ==
- ov::util::Path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗23.txt").u32string());
+ std::filesystem::path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗23.txt").u32string());
EXPECT_TRUE(std::u32string(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗24.txt") ==
- ov::util::Path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗24.txt").u32string());
+ std::filesystem::path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗24.txt").u32string());
}
#if defined(GCC_NOT_USED_OR_VER_AT_LEAST_12_3) && defined(CLANG_NOT_USED_OR_VER_AT_LEAST_17)
@@ -388,63 +387,63 @@ TEST(file_util, path_cast_to_u32string) {
TEST(file_util, path_cast_from_wstring) {
// from wchar_t to char
- EXPECT_STREQ("", ov::util::Path(L"").string().c_str());
- EXPECT_STREQ("file.txt", ov::util::Path(L"file.txt").string().c_str());
- EXPECT_STREQ("./local/file.txt", ov::util::Path(L"./local/file.txt").generic_string().c_str());
- EXPECT_STREQ("~/local/file.txt", ov::util::Path(L"~/local/file.txt").generic_string().c_str());
- EXPECT_STREQ("/usr/local/file.txt", ov::util::Path(L"/usr/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("", std::filesystem::path(L"").string().c_str());
+ EXPECT_STREQ("file.txt", std::filesystem::path(L"file.txt").string().c_str());
+ EXPECT_STREQ("./local/file.txt", std::filesystem::path(L"./local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("~/local/file.txt", std::filesystem::path(L"~/local/file.txt").generic_string().c_str());
+ EXPECT_STREQ("/usr/local/file.txt", std::filesystem::path(L"/usr/local/file.txt").generic_string().c_str());
// from wchar_t to wchar_t
- EXPECT_STREQ(L"", ov::util::Path(L"").wstring().c_str());
- EXPECT_STREQ(L"file.txt", ov::util::Path(L"file.txt").wstring().c_str());
- EXPECT_STREQ(L"./local/file.txt", ov::util::Path(L"./local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"~/local/file.txt", ov::util::Path(L"~/local/file.txt").generic_wstring().c_str());
- EXPECT_STREQ(L"/usr/local/file.txt", ov::util::Path(L"/usr/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"", std::filesystem::path(L"").wstring().c_str());
+ EXPECT_STREQ(L"file.txt", std::filesystem::path(L"file.txt").wstring().c_str());
+ EXPECT_STREQ(L"./local/file.txt", std::filesystem::path(L"./local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"~/local/file.txt", std::filesystem::path(L"~/local/file.txt").generic_wstring().c_str());
+ EXPECT_STREQ(L"/usr/local/file.txt", std::filesystem::path(L"/usr/local/file.txt").generic_wstring().c_str());
// from wchar_t to char16_t
- EXPECT_TRUE(std::u16string(u"") == ov::util::Path(L"").u16string());
- EXPECT_TRUE(std::u16string(u"file.txt") == ov::util::Path(L"file.txt").u16string());
- EXPECT_TRUE(std::u16string(u"./local/file.txt") == ov::util::Path(L"./local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"~/local/file.txt") == ov::util::Path(L"~/local/file.txt").generic_u16string());
- EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == ov::util::Path(L"/usr/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"") == std::filesystem::path(L"").u16string());
+ EXPECT_TRUE(std::u16string(u"file.txt") == std::filesystem::path(L"file.txt").u16string());
+ EXPECT_TRUE(std::u16string(u"./local/file.txt") == std::filesystem::path(L"./local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"~/local/file.txt") == std::filesystem::path(L"~/local/file.txt").generic_u16string());
+ EXPECT_TRUE(std::u16string(u"/usr/local/file.txt") == std::filesystem::path(L"/usr/local/file.txt").generic_u16string());
EXPECT_TRUE(std::u16string(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗26.txt") ==
- ov::util::Path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗26.txt").generic_u16string());
+ std::filesystem::path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗26.txt").generic_u16string());
}
TEST(file_util, path_cast_to_wstring) {
// from char16_t, char32_t to wchar_t
EXPECT_STREQ(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗28.txt",
- ov::util::Path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗28.txt").generic_wstring().c_str());
+ std::filesystem::path(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗28.txt").generic_wstring().c_str());
EXPECT_STREQ(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗30.txt",
- ov::util::Path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗30.txt").wstring().c_str());
+ std::filesystem::path(u"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗30.txt").wstring().c_str());
}
TEST(file_util, path_cast_from_wstring_to_u32string) {
- EXPECT_TRUE(std::u32string(U"") == ov::util::Path(L"").u32string());
- EXPECT_TRUE(std::u32string(U"file.txt") == ov::util::Path(L"file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"./local/file.txt") == ov::util::Path(L"./local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"~/local/file.txt") == ov::util::Path(L"~/local/file.txt").u32string());
- EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == ov::util::Path(L"/usr/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"") == std::filesystem::path(L"").u32string());
+ EXPECT_TRUE(std::u32string(U"file.txt") == std::filesystem::path(L"file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"./local/file.txt") == std::filesystem::path(L"./local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"~/local/file.txt") == std::filesystem::path(L"~/local/file.txt").u32string());
+ EXPECT_TRUE(std::u32string(U"/usr/local/file.txt") == std::filesystem::path(L"/usr/local/file.txt").u32string());
EXPECT_TRUE(std::u32string(U"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗31.txt") ==
- ov::util::Path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗31.txt").u32string());
+ std::filesystem::path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗31.txt").u32string());
}
#endif
TEST(file_util, path_cast_from_wstring_to_char8_t) {
// from wchar_t to char8_t
#if defined(OPENVINO_CPP_VER_AT_LEAST_20)
- EXPECT_TRUE(std::u8string(u8"") == ov::util::Path(L"").u8string());
- EXPECT_TRUE(std::u8string(u8"file.txt") == ov::util::Path(L"file.txt").u8string());
- EXPECT_TRUE(std::u8string(u8"./local/file.txt") == ov::util::Path(L"./local/file.txt").generic_u8string());
- EXPECT_TRUE(std::u8string(u8"~/local/file.txt") == ov::util::Path(L"~/local/file.txt").generic_u8string());
- EXPECT_TRUE(std::u8string(u8"/usr/local/file.txt") == ov::util::Path(L"/usr/local/file.txt").generic_u8string());
+ EXPECT_TRUE(std::u8string(u8"") == std::filesystem::path(L"").u8string());
+ EXPECT_TRUE(std::u8string(u8"file.txt") == std::filesystem::path(L"file.txt").u8string());
+ EXPECT_TRUE(std::u8string(u8"./local/file.txt") == std::filesystem::path(L"./local/file.txt").generic_u8string());
+ EXPECT_TRUE(std::u8string(u8"~/local/file.txt") == std::filesystem::path(L"~/local/file.txt").generic_u8string());
+ EXPECT_TRUE(std::u8string(u8"/usr/local/file.txt") == std::filesystem::path(L"/usr/local/file.txt").generic_u8string());
#elif defined(OPENVINO_CPP_VER_AT_LEAST_17)
- EXPECT_EQ(std::string(""), ov::util::Path(L"").u8string());
- EXPECT_EQ(std::string("file.txt"), ov::util::Path(L"file.txt").u8string());
- EXPECT_EQ(std::string("./local/file.txt"), ov::util::Path(L"./local/file.txt").generic_u8string());
- EXPECT_EQ(std::string("~/local/file.txt"), ov::util::Path(L"~/local/file.txt").generic_u8string());
- EXPECT_EQ(std::string("/usr/local/file.txt"), ov::util::Path(L"/usr/local/file.txt").generic_u8string());
+ EXPECT_EQ(std::string(""), std::filesystem::path(L"").u8string());
+ EXPECT_EQ(std::string("file.txt"), std::filesystem::path(L"file.txt").u8string());
+ EXPECT_EQ(std::string("./local/file.txt"), std::filesystem::path(L"./local/file.txt").generic_u8string());
+ EXPECT_EQ(std::string("~/local/file.txt"), std::filesystem::path(L"~/local/file.txt").generic_u8string());
+ EXPECT_EQ(std::string("/usr/local/file.txt"), std::filesystem::path(L"/usr/local/file.txt").generic_u8string());
#endif
}
@@ -453,12 +452,12 @@ TEST(file_util, unicode_path_cast_from_wstring_to_char8_t) {
#if defined(OPENVINO_CPP_VER_AT_LEAST_20) && defined(GCC_NOT_USED_OR_VER_AT_LEAST_12_3) && \
defined(CLANG_NOT_USED_OR_VER_AT_LEAST_17)
EXPECT_TRUE(std::u8string(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗32.txt") ==
- ov::util::Path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗32.txt").generic_u8string());
+ std::filesystem::path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗32.txt").generic_u8string());
#elif defined(OPENVINO_CPP_VER_AT_LEAST_17) && defined(GCC_NOT_USED_OR_VER_AT_LEAST_12_3) && \
defined(CLANG_NOT_USED_OR_VER_AT_LEAST_17)
EXPECT_EQ(u8"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗33.txt",
- ov::util::Path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗33.txt").generic_u8string());
+ std::filesystem::path(L"~/狗/ǡ୫ԩϗ/にほ/ąę/ど/௸ඊƷ/狗33.txt").generic_u8string());
#endif
}
@@ -494,16 +493,16 @@ protected:
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef OPENVINO_CPP_VER_AT_LEAST_20
{
- std::ofstream outfile(ov::util::Path(u8"这是_u8.txt"));
+ std::ofstream outfile(std::filesystem::path(u8"这是_u8.txt"));
outfile << "This is a test file.";
}
# endif
{
- std::ofstream outfile(ov::util::Path(u"这是_u16.txt"));
+ std::ofstream outfile(std::filesystem::path(u"这是_u16.txt"));
outfile << "This is a test file.";
}
{
- std::ofstream outfile(ov::util::Path(U"这是_u32.txt"));
+ std::ofstream outfile(std::filesystem::path(U"这是_u32.txt"));
outfile << "This is a test file.";
}
{
@@ -540,7 +539,7 @@ protected:
TEST_F(FileUtilTest, FileSizeNonExistentFileTest) {
EXPECT_EQ(ov::util::file_size("non_existent_file.txt"), -1);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("non_existent_file.txt")), -1);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("non_existent_file.txt")), -1);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"non_existent_file.txt")), -1);
}
@@ -552,30 +551,30 @@ TEST_F(FileUtilTest, EmptyFileSizeTest) {
EXPECT_EQ(ov::util::file_size(u"test_file_0.txt"), 0);
EXPECT_EQ(ov::util::file_size(U"test_file_0.txt"), 0);
EXPECT_EQ(ov::util::file_size(std::wstring(L"test_file_0.txt")), 0);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("test_file_0.txt")), 0);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(u8"test_file_0.txt")), 0);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(u"test_file_0.txt")), 0);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(U"test_file_0.txt")), 0);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(L"test_file_0.txt")), 0);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("test_file_0.txt")), 0);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(u8"test_file_0.txt")), 0);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(u"test_file_0.txt")), 0);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(U"test_file_0.txt")), 0);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(L"test_file_0.txt")), 0);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"test_file_0.txt")), 0);
}
TEST_F(FileUtilTest, FileSizeTest) {
EXPECT_EQ(ov::util::file_size("test_file_20.txt"), 20);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"test_file_20.txt")), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("test_file_20.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("test_file_20.txt")), 20);
}
TEST_F(FileUtilTest, FileSizeRawBytesTest) {
EXPECT_EQ(ov::util::file_size("test_file_raw_bytes_746.txt"), 746);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"test_file_raw_bytes_746.txt")), 746);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("test_file_raw_bytes_746.txt")), 746);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("test_file_raw_bytes_746.txt")), 746);
}
TEST_F(FileUtilTest, LargeFileSizeTest) {
EXPECT_EQ(ov::util::file_size("test_file_20x1000.txt"), 20 * 1000);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"test_file_20x1000.txt")), 20 * 1000);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("test_file_20x1000.txt")), 20 * 1000);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("test_file_20x1000.txt")), 20 * 1000);
}
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
@@ -583,7 +582,7 @@ TEST_F(FileUtilTest, LargeFileSizeTest) {
# ifdef OPENVINO_CPP_VER_AT_LEAST_20
TEST_F(FileUtilTest, u8FileSizeTest) {
EXPECT_EQ(ov::util::file_size(u8"这是_u8.txt"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(u8"这是_u8.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(u8"这是_u8.txt")), 20);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"这是_u8.txt")), 20);
}
# endif
@@ -592,31 +591,31 @@ TEST_F(FileUtilTest, u16FileSizeTest) {
EXPECT_EQ(ov::util::file_size("这是_u16.txt"), 20);
# ifdef OPENVINO_CPP_VER_AT_LEAST_20
EXPECT_EQ(ov::util::file_size(u8"这是_u16.txt"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(u8"这是_u16.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(u8"这是_u16.txt")), 20);
# endif
EXPECT_EQ(ov::util::file_size(u"这是_u16.txt"), 20);
EXPECT_EQ(ov::util::file_size(U"这是_u16.txt"), 20);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"这是_u16.txt")), 20);
EXPECT_EQ(ov::util::file_size(std::wstring(L"这是_u16.txt")), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(u"这是_u16.txt")), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(U"这是_u16.txt")), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(std::wstring(L"这是_u16.txt"))), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(u"这是_u16.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(U"这是_u16.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(std::wstring(L"这是_u16.txt"))), 20);
}
TEST_F(FileUtilTest, u32FileSizeTest) {
EXPECT_EQ(ov::util::file_size(U"这是_u32.txt"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(U"这是_u32.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(U"这是_u32.txt")), 20);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"这是_u32.txt")), 20);
}
TEST_F(FileUtilTest, wcharFileSizeTest) {
# ifdef _MSC_VER
EXPECT_EQ(ov::util::file_size(L"这是_wchar.txt"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path(L"这是_wchar.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path(L"这是_wchar.txt")), 20);
# else
EXPECT_EQ(ov::util::file_size("这是_wchar.txt"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("这是_wchar.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("这是_wchar.txt")), 20);
# endif
EXPECT_EQ(ov::util::file_size("这是_wchar.txt"), 20);
EXPECT_EQ(ov::util::file_size(ov::util::make_path(L"这是_wchar.txt")), 20);
@@ -627,12 +626,12 @@ TEST_F(FileUtilTest, wcharFileSizeTest) {
TEST_F(FileUtilTest, androidFileSizeTest) {
EXPECT_EQ(ov::util::file_size("android_test_file_20.txt"), 20);
EXPECT_EQ(ov::util::file_size(L"android_test_file_20.txt"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("android_test_file_20.txt")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("android_test_file_20.txt")), 20);
}
TEST_F(FileUtilTest, androidWithCutFileSizeTest) {
EXPECT_EQ(ov::util::file_size("android_test_file_20.txt!_to_cut.jar"), 20);
EXPECT_EQ(ov::util::file_size(L"android_test_file_20.txt!_to_cut.jar"), 20);
- EXPECT_EQ(ov::util::file_size(ov::util::Path("android_test_file_20.txt!_to_cut.jar")), 20);
+ EXPECT_EQ(ov::util::file_size(std::filesystem::path("android_test_file_20.txt!_to_cut.jar")), 20);
}
#endif