Skip to content

Move to C++17 and rewrite some code to use std::filesystem#29

Closed
ekohl wants to merge 4 commits intoteddych:masterfrom
ekohl:cpp-17-feature
Closed

Move to C++17 and rewrite some code to use std::filesystem#29
ekohl wants to merge 4 commits intoteddych:masterfrom
ekohl:cpp-17-feature

Conversation

@ekohl
Copy link
Contributor

@ekohl ekohl commented Jan 13, 2026

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

ekohl added 4 commits January 13, 2026 18:58
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.
const size_t filenameSearchLength = filenameSearch.length() + 10;
while (true)

for (auto& p: std::filesystem::directory_iterator(path.parent_path()))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In C++17 this can raise exceptions and I'm not sure where to best catch those.

@teddych
Copy link
Owner

teddych commented Jan 19, 2026

I have played around with your implementation and got fast segfaults for the unhandled exceptions.
Basically I do not like to work with exceptions (and in safety related products it it is prohibited). This is one of the main reasons why I never changed to something later than C++11.
I also found problems in my implementation and fixed it.

@teddych teddych marked this pull request as draft January 19, 2026 13:40
@teddych
Copy link
Owner

teddych commented Jan 22, 2026

I have solved the issue with C++11 code.

@teddych teddych closed this Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specifying an absolute path dbfilename breaks cleanup of backup databases

2 participants