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

[Refactoring] Lightweight abstraction of boost::filesystem #1630

Merged

Conversation

random-zebra
Copy link

@random-zebra random-zebra commented May 19, 2020

Based on top of:

Backports bitcoin#9902

Wrap boost::filesystem as the fs namespace, contained in one header.
Also add fsbridge for bridging between stdio.h fopen() and the path type.

This allows:

Replacing it when the time comes with std::filesystem (when standardized, and when we start using the appropriate c++ version) with a single change.

Using custom filesystem implementations that offer the same interface. I need this in cloudabi, a sandboxed environment which has no concept of a global filesystem namespace, where paths need to be accompanied by a file descriptor which grants access to it.

It's less typing, too.

See individual commits for more information.

@random-zebra random-zebra added this to the 5.0.0 milestone May 19, 2020
@random-zebra random-zebra self-assigned this May 19, 2020
@random-zebra random-zebra force-pushed the 202005_boost_filesystem branch 3 times, most recently from f8ab778 to b4df9ae Compare May 23, 2020 12:04
This is step one in abstracting the use of boost::filesystem.

backports bitcoin/bitcoin@7d5172d
Step two in abstracting away boost::filesystem.

To repeat this, simply run:
```
git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g'
```

backports bitcoin/bitcoin@bac5c9c
Abstracts away how a path is opened to a `FILE*`.

Reduces the number of places where path is converted to a string
for anything else but printing.

backports bitcoin/bitcoin@2a5f574
Having these inside functions is silly and redundant now.

backports bitcoin/bitcoin@f110272
@random-zebra
Copy link
Author

Rebased after #1629 merge. Ready for review/QA.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

Code review ACK 286aa99.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

ACK 286aa99.

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 286aa99

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

Successfully merging this pull request may close these issues.

None yet

3 participants