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

Using filesystem path 2 [ANT-1999] #2454

Merged
merged 77 commits into from
Oct 16, 2024
Merged

Using filesystem path 2 [ANT-1999] #2454

merged 77 commits into from
Oct 16, 2024

Conversation

payetvin
Copy link
Contributor

@payetvin payetvin commented Oct 7, 2024

following #2435

@payetvin payetvin added this to the Sprint 9 milestone Oct 7, 2024
@payetvin payetvin self-assigned this Oct 7, 2024
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Oct 7, 2024
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 7, 2024
@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 8, 2024
Copy link
Member

@flomnes flomnes left a comment

Choose a reason for hiding this comment

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

Good job !
Please change the following

  • loadFromFolder(const std::string&, ...) => loadFromFolder(const std::filesystem::path&, ...)
  • same for saveToFolder ?
  • same for addFromBuffer
  • You may use attribute [[deprecated]]

Comment on lines -181 to -191
template<class StringT>
size_t sizeOnDisk(const StringT& sourceFolder) const
{
if (item.empty())
{
return 0;
}
pTmp = sourceFolder;
return (!pTmp) ? 0 : internalSizeOnDisk();
}

Copy link
Member

Choose a reason for hiding this comment

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

Note to other readers: this function is unused

Comment on lines -44 to -60
size_t PathList::internalSizeOnDisk() const
{
size_t size = 0;
Clob buffer;

const ItemList::const_iterator end = item.end();
for (ItemList::const_iterator i = item.begin(); i != end; ++i)
{
if (!(i->second.options & pathListOptFolder))
{
buffer.clear() << pTmp << SEP << i->first;
size += (size_t)IO::File::Size(pTmp);
}
}
return size;
}

Copy link
Member

Choose a reason for hiding this comment

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

Note: this function is unused.

src/libs/antares/paths/list.cpp Show resolved Hide resolved
src/libs/antares/study/xcast/xcast.cpp Show resolved Hide resolved
src/solver/simulation/solver_utils.cpp Outdated Show resolved Hide resolved
src/solver/simulation/solver_utils.cpp Outdated Show resolved Hide resolved
@@ -254,7 +251,7 @@ void List<NextT>::buildSurveyReport(SurveyResults& results,

// The new filename
results.data.filename.clear();
results.data.filename << results.data.output << SEP;
results.data.filename << std::filesystem::path(std::string(results.data.output)) / "";
Copy link
Member

Choose a reason for hiding this comment

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

This is ugly...

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 agree, but it avoids intermediate variables needed to convert from yuni string

Comment on lines +360 to +361
path /= std::filesystem::path("areas") / area.id.to<std::string>() / "thermal"
/ cluster->id();
Copy link
Member

Choose a reason for hiding this comment

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

If you have a typedef, you can just use

Suggested change
path /= std::filesystem::path("areas") / area.id.to<std::string>() / "thermal"
/ cluster->id();
path /= fs("areas") / area.id.to<std::string>() / "thermal"
/ cluster->id();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a hxx file, i don't use typedef

@payetvin payetvin merged commit 0bb9b9a into develop Oct 16, 2024
7 checks passed
@payetvin payetvin deleted the feature/use-std-fs branch October 16, 2024 11:48
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants