CppCommon  1.0.4.1
C++ Common Library
filesystem_path.cpp

Filesystem path example

#include <iostream>
int main(int argc, char** argv)
{
std::cout << "Path deprecated: " << CppCommon::Path::deprecated() << std::endl;
std::cout << "Path separator: " << CppCommon::Path::separator() << std::endl;
std::cout << "Initial path: " << CppCommon::Path::initial() << std::endl;
std::cout << "Current path: " << CppCommon::Path::current() << std::endl;
std::cout << "Executable path: " << CppCommon::Path::executable() << std::endl;
std::cout << "Home path: " << CppCommon::Path::home() << std::endl;
std::cout << "Temporary path: " << CppCommon::Path::temp() << std::endl;
std::cout << "Unique filename: " << CppCommon::Path::unique() << std::endl;
std::cout << std::endl;
std::cout << "Filesystem capacity: " << CppCommon::Path::current().space().capacity << std::endl;
std::cout << "Filesystem free: " << CppCommon::Path::current().space().free << std::endl;
std::cout << "Filesystem available: " << CppCommon::Path::current().space().available << std::endl;
return 0;
}
static Path unique()
Get the unique filename in UUID format "00000000-0000-0000-0000-000000000000".
Definition: path.cpp:1012
static Path initial()
Get the initial path of the process.
Definition: path.cpp:875
static Path home()
Get the home path of the process.
Definition: path.cpp:945
SpaceInfo space() const
Get the path space information.
Definition: path.cpp:644
static char separator() noexcept
Get the system path separator character ('\' for Windows or '/' for Unix)
Definition: path.cpp:866
static std::string deprecated()
Get filesystem deprecated characters ('\', '/', '?', '', '*', ':', '|', '"', '<', '>')
Definition: path.cpp:861
static Path temp()
Get the temporary path of the process.
Definition: path.cpp:987
static Path current()
Get the current path of the process.
Definition: path.cpp:880
static Path executable()
Get the executable path of the process.
Definition: path.cpp:910
Filesystem path definition.
uint64_t capacity
Total size of the filesystem, in bytes.
Definition: path.h:73
uint64_t free
Free space on the filesystem, in bytes.
Definition: path.h:74
uint64_t available
Free space available to a non-privileged process (may be equal or less than free)
Definition: path.h:75