Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORE] OV file utils file_size use std file path #28462

Merged
merged 59 commits into from
Feb 5, 2025
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
887dd2b
move wide character string conversions to separate file
barnasm1 Jan 15, 2025
04671c7
refactor
barnasm1 Jan 15, 2025
b334528
refactor file size functions to use ov::util::Path and handle Android…
barnasm1 Jan 15, 2025
c0ec93e
add unit tests for cut_android_path function
barnasm1 Jan 15, 2025
dce5d59
add unit tests for file size functions with various file types and en…
barnasm1 Jan 15, 2025
701cd96
code format
barnasm1 Jan 15, 2025
97f2a96
prevent variable redefinition for android
barnasm1 Jan 15, 2025
c0345b1
refactor test to use ov::util::Path for Unicode file output
barnasm1 Jan 15, 2025
66615dc
Merge branch 'master' into ov_file_path_util_file_size
mlukasze Jan 16, 2025
a1e8053
add Windows-specific includes for wstring_cast_util
barnasm1 Jan 16, 2025
f34b2d2
fix comment typo
barnasm1 Jan 16, 2025
2d071bf
refactor cpp_version.hpp and file_path.hpp for compiler version checks
barnasm1 Jan 16, 2025
3b2fbae
refactor WPath function to use lambda syntax, to meet Naming style check
barnasm1 Jan 16, 2025
eed127e
update copyright year to 2025, fix typos,
barnasm1 Jan 16, 2025
067224b
rename wstring_cast_util to wstring_convert_util and update includes
barnasm1 Jan 16, 2025
22d6712
add Android-specific file size test
barnasm1 Jan 16, 2025
2e7cf52
fix typo in CMakeLists.txt for wstring_convert_util source file path
barnasm1 Jan 16, 2025
e9c2cca
deprecate old file_size function and provide alternative usage guidance
barnasm1 Jan 16, 2025
71e2206
update file size tests to use string literals
barnasm1 Jan 16, 2025
c8bdb3b
skip file size tests based on C++ version
barnasm1 Jan 16, 2025
dd13c04
revert: refactor WPath function to use lambda syntax, to meet Naming …
barnasm1 Jan 16, 2025
74640d8
Merge branch 'master' into ov_file_path_util_file_size
barnasm1 Jan 21, 2025
0f2aa4a
clang format
barnasm1 Jan 22, 2025
76d0a49
Merge branch 'master' into ov_file_path_util_file_size
barnasm1 Jan 23, 2025
f9cd47d
Merge branch 'master' into ov_file_path_util_file_size
barnasm1 Jan 27, 2025
0794bcd
Refactor namespace declaration
barnasm1 Jan 27, 2025
8d745c5
Replace file size calculation with std::filesystem
barnasm1 Jan 27, 2025
a82aef0
Refactor cut_android_path function for improved readability
barnasm1 Jan 27, 2025
77dd50f
Remove deprecated file_size function
barnasm1 Jan 27, 2025
d45867d
Update file_size function to use ov::util namespace for consistency
barnasm1 Jan 27, 2025
8837c2e
Refactor file path handling and update file size functions
barnasm1 Jan 28, 2025
d9a9487
Revert "Remove deprecated file_size function"
barnasm1 Jan 28, 2025
6c8b9a5
Fix preprocessor directive formatting for GCC and Clang version checks
barnasm1 Jan 28, 2025
8acae29
Fix file_size function to handle Android paths correctly
barnasm1 Jan 28, 2025
b45c26b
Update file size tests to use string literals to avoid deprecation wa…
barnasm1 Jan 28, 2025
65cc6d5
Add Unicode content tests for file size functionality
barnasm1 Jan 28, 2025
bab5a77
Add test for file size calculation of raw byte files
barnasm1 Jan 29, 2025
b8cf8dc
Remove Unicode content tests and related setup from FileUtilTest
barnasm1 Jan 29, 2025
f4cb551
cut_android_path function restrict
barnasm1 Jan 29, 2025
feab0bd
check if cut_android_path is required at new impl
barnasm1 Jan 29, 2025
07f5a1b
Refactor file size and clean up unused includes
barnasm1 Jan 29, 2025
3c90e81
Update file_size function to accept std::wstring and adjust related t…
barnasm1 Jan 29, 2025
664b578
Remove deprecated file_size function for std::wstring and update path…
barnasm1 Jan 29, 2025
3227347
Simplify file_size function implementation
barnasm1 Jan 29, 2025
b0f211c
Update test to avoid filesize discrepancies of std::endl platforms en…
barnasm1 Jan 30, 2025
b28d093
Merge branch 'master' into ov_file_path_util_file_size
mlukasze Jan 31, 2025
b9b1a56
Deprecate old file_size function and update tests
barnasm1 Jan 31, 2025
afacbb0
Remove string literal suffixes from file_size test cases
barnasm1 Jan 31, 2025
99a18fb
Merge branch 'master' into ov_file_path_util_file_size
mlukasze Feb 3, 2025
69b84e1
Merge branch 'master' into ov_file_path_util_file_size
barnasm1 Feb 3, 2025
1fb30c1
Remove wstring_convert_util.cpp from source files properties in CMake…
barnasm1 Feb 3, 2025
3ed752e
fix: update file names in tests to remove underscores
barnasm1 Feb 3, 2025
7b44026
fix: update file_util tests on for unix
barnasm1 Feb 3, 2025
60e848c
test: add/fix tests for file size with Unicode character file names
barnasm1 Feb 4, 2025
073dde2
fix: add make_path overload for char* in file_util.hpp
barnasm1 Feb 4, 2025
190dd78
fix: add char* overload for file_size and simplify make_path usage in…
barnasm1 Feb 4, 2025
72978e5
refactor: remove Android-specific path handling code and associated t…
barnasm1 Feb 4, 2025
49422c4
Merge branch 'master' into ov_file_path_util_file_size
mlukasze Feb 5, 2025
4357671
Remove conditional compilation for make_path function in file_util.hpp
barnasm1 Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prevent variable redefinition for android
barnasm1 committed Jan 15, 2025
commit 97f2a96dbdd02a4f45f3fb0ba62f25513fd12753
11 changes: 7 additions & 4 deletions src/common/util/include/openvino/util/file_util.hpp
Original file line number Diff line number Diff line change
@@ -176,12 +176,15 @@ inline ov::util::Path cut_android_path(const ov::util::Path& file_name) {
* @param[in] path The file name
* @return file size
*/
inline int64_t file_size(const ov::util::Path& file_name) {
inline int64_t file_size(const ov::util::Path& path) {
barnasm1 marked this conversation as resolved.
Show resolved Hide resolved
#if defined(__ANDROID__) || defined(ANDROID)
const ov::util::Path& file_name = cut_android_path(file_name);
#endif
std::ifstream in(file_name, std::ios_base::binary | std::ios_base::ate);
const ov::util::Path& cut_path = cut_android_path(path);
std::ifstream in(cut_path, std::ios_base::binary | std::ios_base::ate);
return in.tellg();
#else
std::ifstream in(path, std::ios_base::binary | std::ios_base::ate);
return in.tellg();
#endif
}

/**