Skip to content

Switch to gulrak/filesystem #938

Description

@COM8
          Hey, Fabian, after some more research, I think I should update my recommendation here: 

I really think we should backport std::filesystem with https://github.com/gulrak/filesystem instead of boost::filesystem.

gulrak/filesystem is std::filesystem-compatible (and header-only), sidestepping a lot of the pain we were getting in my other project from the API differences between boost::filesystem and std::filesystem. I'm guessing it'll save you a lot of API-divergence pain, too, as code continues to build on filesystem.

What do you think?

Some notes:

  • I started by tossing up a PR with them Dynamic selection for more Apple platforms gulrak/filesystem#167 to add support for non-desktop Apple platforms (which we needed) and to clean things up a bit.
  • Since it's header-only, the change could be as easy as grabbing some of their headers to replace the contents of libcpr's filesystem.h.
    • I already hacked together something simple on the Bazel side--haven't pushed yet, but libcpr compiles cleanly if you just swap in gulrak/filesystem for boost, conditionals and all.
    • You guys almost certainly have comparative advantage over me with cmake, so I think I should ask if you'd do the actual integration there.
      [One tricky case to think about: If you want to support the shared-library case, you'll want to make sure the same filesystem importation gets picked even if the final binary has a higher min OS version (deployment target) than was used for libcpr compilation. Not sure how cmake usually handles this...
  • You might want to amend their conditionals further to use experimental/filesystem if you feel like it? Happy to add it to my PR, but I don't know the history or tradeoffs as well there as you might.

Cheers!
Chris

P.S. Wish I'd steered us to this straight away when I saw someone had added the broken boost backport...sorry I just learned about it.

Originally posted by @cpsauer in #929 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions