Return std::filesystem::path from TempDir methods - #8010
Open
Coelho-Gustavo wants to merge 43 commits into
Open
Conversation
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/ec2fa57d-2d9c-4388-b4e1-90a40f55b5e8 Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/ec2fa57d-2d9c-4388-b4e1-90a40f55b5e8 Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/ec2fa57d-2d9c-4388-b4e1-90a40f55b5e8 Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/e53fe2d3-e57e-4ad9-9d43-5dc1519645fc Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/e5845adb-dc3f-46cf-8461-0ea7855be1cf Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
…eplace-boost-filesystem # Conflicts: # src/xrpld/core/Config.h Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
… improvements Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/629eace2-9c23-40d9-89f5-9ef3099cdf14 Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
…t path streams, errno propagation Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/ebfae1ee-800f-4a23-b484-a709c2321693 Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…velop naming Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/a872065b-cdb8-47a7-8acb-3ece056594ca Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
…test Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/a8d8f682-0faf-4cb5-a330-39dc6fb7408f Co-authored-by: mathbunnyru <12270691+mathbunnyru@users.noreply.github.com>
…e line) Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/8ef69f5f-e752-47b2-a4a3-2746d0dbfe78 Co-authored-by: mathbunnyru <12270691+mathbunnyru@users.noreply.github.com>
…YU pragmas) Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/56410194-a137-4a12-ad17-fc4fffb31d86 Co-authored-by: mathbunnyru <12270691+mathbunnyru@users.noreply.github.com>
…tating Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/3807ab03-d6e1-4466-a2b9-b7512b943bba Co-authored-by: mathbunnyru <12270691+mathbunnyru@users.noreply.github.com>
…::absolute(p,base) behavior Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/41d17280-3340-4246-97d4-06f2bcf365cb Co-authored-by: mathbunnyru <12270691+mathbunnyru@users.noreply.github.com>
…ot/refactor-replace-boost-filesystem # Conflicts: # src/libxrpl/server/Vacuum.cpp # src/test/app/GRPCServerTLS_test.cpp # src/xrpld/app/rdb/backend/detail/Node.cpp # src/xrpld/core/detail/Config.cpp Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
…eplace-boost-filesystem # Conflicts: # src/xrpld/core/Config.h # src/xrpld/core/detail/Config.cpp
…eplace-boost-filesystem # Conflicts: # src/test/app/GRPCServerTLS_test.cpp # src/test/app/SHAMapStore_test.cpp # src/xrpld/app/misc/SHAMapStoreImp.cpp # src/xrpld/app/rdb/backend/detail/Node.cpp # src/xrpld/core/detail/Config.cpp
…te new GTest FileUtilities, remove stale boost::filesystem includes
…eplace-boost-filesystem # Conflicts: # include/xrpl/beast/unit_test/suite.h Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
…opilot/refactor-replace-boost-filesystem # Conflicts: # src/test/core/SociDB_test.cpp Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
- Move the helper out of beast/utility/temp_dir.h into
xrpl/basics/FileUtilities.{h,cpp}, since it is used by production code
to generate non-temporary paths and is unrelated to beast.
- Reorder parameters to (base, prefix, maxAttempts) so callers can pass
just a prefix.
- Drop the now-unneeded <boost/lexical_cast.hpp> include in suite.h.
beast/utility/temp_dir.h could not include xrpl/basics/FileUtilities.h without creating a levelization loop (xrpl.basics already depends on xrpl.beast), so move the whole RAII helper to xrpl/basics/TempDir.h in namespace xrpl.
TempDir is only used by tests and benchmarks, so it does not belong in libxrpl. Move it to src/test_helpers/TempDir.h, reached as <test_helpers/TempDir.h> from xrpld, xrpl_tests and the benchmark binaries. uniqueRandomPath stays in libxrpl, where SHAMapStoreImp needs it. Also initialize path_ in the member initializer, warn instead of silently ignoring a failed cleanup, simplify the perms spelling in PerfLog_test, and drop the redundant dir_ member from the FileUtilities test fixture.
Per review, avoid a new source directory plus isolate_headers/cmake plumbing for a single header: declare TempDir in xrpl/basics/FileUtilities.h next to uniqueRandomPath, with the implementation in src/libxrpl/basics/FileUtilities.cpp.
Return std::filesystem::path from TempDir::path() and TempDir::file(), and accept a std::filesystem::path in TempDir::file(), so callers no longer round-trip through std::string. Update call sites in tests and benchmarks. Closes XRPLF#8007.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
mathbunnyru
requested changes
Aug 14, 2026
mathbunnyru
left a comment
Contributor
There was a problem hiding this comment.
Please, update your branch to include only necessary changes on top of latest develop
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.
Summary
Follow-up on #8007 (review comment from #7012).
TempDir::path()andTempDir::file()now returnstd::filesystem::path, andTempDir::file()takes astd::filesystem::path const&, so callers no longer round-trip throughstd::string. Updated the affected call sites (tests/benchmarks).Closes #8007
Note: stacked on #7012 (this diff will shrink once #7012 merges).