Move to C++17 and rewrite some code to use std::filesystem#29
Closed
ekohl wants to merge 4 commits intoteddych:masterfrom
Closed
Move to C++17 and rewrite some code to use std::filesystem#29ekohl wants to merge 4 commits intoteddych:masterfrom
ekohl wants to merge 4 commits intoteddych:masterfrom
Conversation
C++ implements std::filesystem::copy_file which makes this function a trivial wrapper that only adds logging.
Previously it was assumed the files were in the current directory, but this doesn't have to be the case. This gets the parent path of the file, changing the assumption that backups are in the same directory as the file itself.
ekohl
commented
Jan 13, 2026
| const size_t filenameSearchLength = filenameSearch.length() + 10; | ||
| while (true) | ||
|
|
||
| for (auto& p: std::filesystem::directory_iterator(path.parent_path())) |
Contributor
Author
There was a problem hiding this comment.
In C++17 this can raise exceptions and I'm not sure where to best catch those.
Owner
|
I have played around with your implementation and got fast segfaults for the unhandled exceptions. |
Owner
|
I have solved the issue with C++11 code. |
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.
C++17 introduces std::filesystem as a platform agnostic library for filesystem operations. It doesn't fully rewrite the handling and more code could benefit from it.
Also includes a bugfix as its own commit.
Fixes #22