Bitcoin ABC  0.26.3
P2P Digital Currency
Classes | Functions
fs Namespace Reference

Filesystem operations and types. More...

Classes

class  path
 Path class wrapper to prepare application code for transition from boost::filesystem library to std::filesystem implementation. More...
 

Functions

static path u8path (const std::string &string)
 
static path system_complete (const path &p)
 
static bool exists (const path &p)
 
static auto quoted (const std::string &s)
 
static path operator+ (path p1, path p2)
 
static std::string PathToString (const path &path)
 Convert path object to byte string. More...
 
static path PathFromString (const std::string &string)
 Convert byte string to path object. More...
 

Detailed Description

Filesystem operations and types.

Function Documentation

◆ exists()

static bool fs::exists ( const path p)
inlinestatic

Definition at line 94 of file fs.h.

Here is the caller graph for this function:

◆ operator+()

static path fs::operator+ ( path  p1,
path  p2 
)
inlinestatic

Definition at line 104 of file fs.h.

◆ PathFromString()

static path fs::PathFromString ( const std::string &  string)
inlinestatic

Convert byte string to path object.

Inverse of PathToString.

Definition at line 147 of file fs.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PathToString()

static std::string fs::PathToString ( const path path)
inlinestatic

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. But they are not guaranteed to be valid UTF-8, and are generally meant to be used internally, not externally. When communicating with external programs and libraries that require UTF-8, fs::path::u8string() and fs::u8path() methods can be used. For other applications, if support for non UTF-8 paths is required, or if higher-level JSON or XML or URI or C-style escapes are preferred, it may be also be appropriate to use different path encoding functions.

Implementation note: On Windows, the std::filesystem::path(string) constructor and std::filesystem::path::string() method are not safe to use here, because these methods encode the path using C++'s narrow multibyte encoding, which on Windows corresponds to the current "code page", which is unpredictable and typically not able to represent all valid paths. So std::filesystem::path::u8string() and std::filesystem::u8path() functions are used instead on Windows. On POSIX, u8string/u8path functions are not safe to use because paths are not always valid UTF-8, so plain string methods which do not transform the path there are used.

Definition at line 134 of file fs.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quoted()

static auto fs::quoted ( const std::string &  s)
inlinestatic

Definition at line 99 of file fs.h.

Here is the caller graph for this function:

◆ system_complete()

static path fs::system_complete ( const path p)
inlinestatic

Definition at line 88 of file fs.h.

Here is the caller graph for this function:

◆ u8path()

static path fs::u8path ( const std::string &  string)
inlinestatic

Definition at line 82 of file fs.h.

Here is the caller graph for this function: