-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Use boost::filesystem::path
in readFileAsString()
#11650
Conversation
a305a28
to
4072341
Compare
if (m_args.count(g_argInputFile)) | ||
for (string path: m_args[g_argInputFile].as<vector<string>>()) | ||
{ | ||
auto infile = boost::filesystem::path(path); | ||
boost::filesystem::path infile = path; | ||
if (!boost::filesystem::exists(infile)) | ||
{ | ||
if (!ignoreMissing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While updating this I noticed that solidity-upgrade
has the file processing logic duplicated from CommandLineInterface
and now, after the recent round of CLI refactors, it's out of sync. #11651.
I think this may have been a conscious decision to keep boost's presence limited. I guess now there's an implicit constructor from string in cases it does not receive a path? Does having I am not campaigning against this, but the change seems to have some other cleanups, and in the end we trade a single |
I partly agree here, @axic. I do remember though that I was once motivated to use I however prefer ( |
I would have actually approved this PR, but your comment made me hold back, axic. Maybe we want to re-evaluate the use of std::filesystem again? |
Yeah.
I doubt it because it's not a header-only library. I did not notice any egregious change but I'd have to measure it to be sure how much it adds.
I saw them and I left them unchanged on purpose. They are not generic path functions, they're meant for our VFS paths with all the quirks like
For me it's about the interface. I highly prefer to see a path type where an actual path is expected (could be
I think it's risky. There are subtle differences between the two that affect normalization (see for example boostorg/filesystem#88 (comment)) and I think we do not have enough test coverage related to paths to just swap one with another and expect things not to be broken in some way. The new stuff I'm adding is covered pretty extensively but the existing code mostly is not. |
@axic @christianparpart any conclusions here after @cameel 's comment? |
I'm fine with actual filesystem functions using boost::filesystem |
Can we get this merged? |
4072341
to
cb1a0f0
Compare
Small refactor of
readFileAsString()
requested in #11544 (comment).Originally the function accepted the path as
std::string
, now it'sboost::filesystem::path
.