Open
Conversation
- Added two new from_string overloads to allow writing file contents while setting explicit boost::filesystem::perms - Ensures callers can both write file content and control file permissions in one operation. - Maintains consistency with existing from_string API by providing both error-code and exception-throwing variants.
daminetreg
reviewed
Sep 10, 2025
pre/file/string.hpp
Outdated
Comment on lines
+94
to
+97
| inline void from_string(const std::string &path, const std::string &content, std::error_condition &ec,const boost::filesystem::perms& perms, boost::system::error_code& ec_perms) { | ||
| from_string(path, content, ec); | ||
| boost::filesystem::permissions(path, perms, ec_perms); | ||
| } |
Contributor
There was a problem hiding this comment.
I don't think it's a great idea to have 2 error code types, we should at least stanrdadize on the same type, that there are 2 parameters : why not. But it would be better there would be only one holding both codes and the function could just return early on error.
- return earlier in case of write error
daminetreg
reviewed
Mar 2, 2026
Contributor
daminetreg
left a comment
There was a problem hiding this comment.
Here one thing that I dislike about these abstractions is that they don't write directly with the provided permissions. They write with whatever permissions and then set them afterwards.
I don't know if it's doable otherwise, but that would be my comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The purpose of this program is to be able to manage the writing or modification of content while simultaneously managing file permissions.