Bitcoin ABC 0.26.3
P2P Digital Currency
|
Filesystem operations and types. More...
Classes | |
class | path |
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path::string() method, which have unsafe and unpredictable behavior on Windows (see implementation note in PathToString for details) More... | |
Functions | |
static path | u8path (const std::string &utf8_str) |
static path | absolute (const path &p) |
static bool | exists (const path &p) |
static auto | quoted (const std::string &s) |
static path | operator+ (path p1, path p2) |
static bool | copy_file (const path &from, const path &to, copy_options options) |
static std::string | PathToString (const path &path) |
Convert path object to byte string. | |
static path | PathFromString (const std::string &string) |
Convert byte string to path object. | |
static bool | create_directories (const std::filesystem::path &p) |
Create directory (and if necessary its parents), unless the leaf directory already exists or is a symlink to an existing directory. | |
bool | create_directories (const std::filesystem::path &p, std::error_code &ec)=delete |
This variant is not used. | |
Filesystem operations and types.
|
inlinestatic |
Create directory (and if necessary its parents), unless the leaf directory already exists or is a symlink to an existing directory.
This is a temporary workaround for an issue in libstdc++ that has been fixed upstream [PR101510].
Definition at line 179 of file fs.h.
|
delete |
This variant is not used.
Delete it to prevent it from accidentally working around the workaround. If it is needed, add a workaround in the same pattern as above.
Convert byte string to path object.
Inverse of PathToString.
Definition at line 165 of file fs.h.
Convert path object to byte string.
On POSIX, paths natively are byte strings, so this is trivial. On Windows, paths natively are Unicode, so an encoding step is necessary. The inverse of PathToString is PathFromString. The strings returned and parsed by these functions can be used to call POSIX APIs, and for roundtrip conversion, logging, and debugging.
Because PathToString and PathFromString functions don't specify an encoding, they are meant to be used internally, not externally. They are not appropriate to use in applications requiring UTF-8, where fs::path::u8string() and fs::u8path() methods should be used instead. Other applications could require still different encodings. For example, JSON, XML, or URI applications might prefer to use higher level escapes (\uXXXX or &XXXX; or XX) instead of multibyte encoding. Rust, Python, Java applications may require encoding paths with their respective UTF-8 derivatives WTF-8, PEP-383, and CESU-8 (see https://en.wikipedia.org/wiki/UTF-8#Derivatives).
Definition at line 142 of file fs.h.