Skip to content

Return std::filesystem::path from TempDir methods - #8010

Open
Coelho-Gustavo wants to merge 43 commits into
XRPLF:developfrom
Coelho-Gustavo:8007-tempdir-std-path
Open

Return std::filesystem::path from TempDir methods#8010
Coelho-Gustavo wants to merge 43 commits into
XRPLF:developfrom
Coelho-Gustavo:8007-tempdir-std-path

Conversation

@Coelho-Gustavo

Copy link
Copy Markdown

Summary

Follow-up on #8007 (review comment from #7012).

TempDir::path() and TempDir::file() now return std::filesystem::path, and TempDir::file() takes a std::filesystem::path const&, so callers no longer round-trip through std::string. Updated the affected call sites (tests/benchmarks).

Closes #8007

Note: stacked on #7012 (this diff will shrink once #7012 merges).

Copilot AI and others added 30 commits April 24, 2026 13:24
…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>
…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>
Copilot AI and others added 13 commits August 10, 2026 18:53
…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.
@github-actions

Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@mathbunnyru mathbunnyru left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please, update your branch to include only necessary changes on top of latest develop

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return std::filesystem::path from TempDir::path() and TempDir::file()

4 participants