Skip to content

[CORE] Refactor function signatures to use std::filesystem::path #31046

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yangwang201911
Copy link
Contributor

Details:

  • read_model()
  • file_exists()

Tickets:

  • ticket-id

@github-actions github-actions bot added category: inference OpenVINO Runtime library - Inference category: Core OpenVINO Core (aka ngraph) category: IE Tests OpenVINO Test: plugins and common category: CPP API OpenVINO CPP API bindings category: JS API OpenVino JS API Bindings labels Jun 19, 2025
@@ -176,42 +176,13 @@ inline int64_t file_size(const char* path) {
* @param[in] path The file name
* @return file size
*/
inline bool file_exists(const char* path) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will recommend to refactor this util function first and test it (as separate PR).
There is specific handing for android paths, I'm not sure if std implementation will work the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will recommend to refactor this util function first and test it (as separate PR). There is specific handing for android paths, I'm not sure if std implementation will work the same.

Refactor file_exists() will be here: #31272

* @param properties Optional map of pairs: (property name, property value) relevant only for this read operation.
* @return A model.
*/
std::shared_ptr<ov::Model> read_model(const std::wstring& model_path,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general direction should be to remove string versions (and is good) but they cannot be removed without
deprecation first (maybe only std::string versions could be removed).

The implementation should be done like std::filesystem::Path keeps main implementation and std::(w)string are just wrappers to create paths objects. The version with wstring can be useful to apply our internal util for wstring conversion to create paths objects. But it will requires testing which option is the best.

The internal classes/functions can use path object without deprecation, just requires proper handling

@@ -148,12 +148,12 @@ std::shared_ptr<ov::Model> read_model(const std::string& modelPath,
return model;
}

const auto fileExt = modelPath.substr(modelPath.find_last_of(".") + 1);
const auto fileExt = model_path.substr(model_path.find_last_of(".") + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is dedicated member in path object to get extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: IE Tests OpenVINO Test: plugins and common category: inference OpenVINO Runtime library - Inference category: JS API OpenVino JS API Bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants