Bitcoin Core  22.99.0
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 77 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 89 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 136 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.

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 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 113 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 83 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 70 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 63 of file fs.h.

Here is the caller graph for this function: