This pull request is part of the libbitcoinkernel
project #24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its “Step 2: Decouple most non-consensus code from libbitcoinkernel”. This commit was originally authored by empact and is taken from its parent PR #25152.
Context
There is an ongoing effort to decouple the ArgsManager
used for command line parsing user-provided arguments from the libbitcoinkernel library (https://github.com/bitcoin/bitcoin/pull/25290, #25487, #25527, #25862, #26177, and #27125). The ArgsManager
is defined in system.h
. A similar pull request extracting functionality from system.h
has been merged in #27238.
Changes
Next to providing better code organization, this PR removes some reliance of the tree of libbitcoinkernel header includes on system.h
(and thus the ArgsManager
definition) by moving filesystem related functions out of the system.*
files.
There is already a pair of fs.h
/ fs.cpp
in the top-level src/
directory. They were not combined with the files introduced here, to keep the patch cleaner and more importantly because they are often included without the utility functions. The new files are therefore named fs_helpers
and the existing fs
files are moved into the util directory.
Further commits splitting more functionality out of system.h
are still in #25152 and will be submitted in separate PRs once this PR has been processed.