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

Migrate from boost::filesystem to std::filesystem #101

Open
AlanGriffiths opened this issue Oct 28, 2022 · 1 comment
Open

Migrate from boost::filesystem to std::filesystem #101

AlanGriffiths opened this issue Oct 28, 2022 · 1 comment

Comments

@AlanGriffiths
Copy link
Contributor

C++17 introduced std::filesystem, so it would be better to use that than Boost

But the default Ubuntu 20.04 standard library only has std::experimental::filesystem which is subtly different. So it may be worth deferring the migration until we move to base: core22

@AlanGriffiths
Copy link
Contributor Author

#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
int main()
{
    for(fs::path p : {"/var/tmp/example.txt", "/", "/var/tmp/.", "foo", "./foo", "nonexistant/foo"})
        std::cout << "The parent path of " << p
                  << " is " << p.parent_path() 
		  << ", empty=" << p.parent_path().empty()
		  << ", exists=" << exists(p.parent_path()) << '\n';
}

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

No branches or pull requests

1 participant