4.6.0
Freundlich's C++ toolkit
|
Helper functions for std::filesystem.
Link to ${fcppt_filesystem_TARGET}
, or to fcppt_filesystem_interface
if you only need the headers.
Classes | |
class | fcppt::filesystem::directory_range |
A range for directory iterators. More... | |
class | fcppt::filesystem::recursive_directory_range |
A range for recursive directory iterators. More... | |
Typedefs | |
using | fcppt::filesystem::optional_size = fcppt::optional::object<std::uintmax_t> |
Optional size. | |
Functions | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::optional_error_code | fcppt::filesystem::create_directories_recursive (std::filesystem::path const &path) |
Tries to creates directories recursively. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::optional_error_code | fcppt::filesystem::create_directory (std::filesystem::path const &path) |
Tries to create a directory. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::string | fcppt::filesystem::extension (std::filesystem::path const &path) |
Returns the extension of a path as an fcppt::string. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::string | fcppt::filesystem::extension_without_dot (std::filesystem::path const &path) |
Returns the extension of a path as an fcppt::string without the dot. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::filesystem::optional_size | fcppt::filesystem::file_size (std::filesystem::path const &path) |
Returns the size of a file. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::either::object< std::error_code, fcppt::filesystem::directory_range > | fcppt::filesystem::make_directory_range (std::filesystem::path const &, std::filesystem::directory_options) |
Creates a directory range. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::either::object< std::error_code, fcppt::filesystem::recursive_directory_range > | fcppt::filesystem::make_recursive_directory_range (std::filesystem::path const &, std::filesystem::directory_options) |
Creates a recursive directory range. | |
template<typename Stream > | |
fcppt::optional::object< Stream > | fcppt::filesystem::open (std::filesystem::path const &_path, std::ios_base::openmode const _openmode) |
Opens a file, returning an optional. | |
template<typename Stream , typename Exception = fcppt::exception> | |
Stream | fcppt::filesystem::open_exn (std::filesystem::path const &_path, std::ios_base::openmode const _openmode) |
Opens a file, throwing an exception on failure. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::string | fcppt::filesystem::path_to_string (std::filesystem::path const &path) |
Turns a path into an fcppt::string. | |
FCPPT_FILESYSTEM_DETAIL_SYMBOL std::filesystem::path | fcppt::filesystem::remove_extension (std::filesystem::path path) |
Removes the extension from a path. | |
using fcppt::filesystem::optional_size = fcppt::optional::object<std::uintmax_t> |
Optional size.
|
nodiscard |
Tries to creates directories recursively.
Tries to create each nonexistant sub directory of path.
|
nodiscard |
Tries to create a directory.
Tries to create the last component of path as a directory.
|
nodiscard |
Returns the extension of a path as an fcppt::string.
|
nodiscard |
Returns the extension of a path as an fcppt::string without the dot.
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::filesystem::optional_size fcppt::filesystem::file_size | ( | std::filesystem::path const & | path | ) |
Returns the size of a file.
Returns the size of path if it exists and its size can be obtained, otherwise returns the empty optional.
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::either::object< std::error_code, fcppt::filesystem::directory_range > fcppt::filesystem::make_directory_range | ( | std::filesystem::path const & | , |
std::filesystem::directory_options | ) |
Creates a directory range.
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::either::object< std::error_code, fcppt::filesystem::recursive_directory_range > fcppt::filesystem::make_recursive_directory_range | ( | std::filesystem::path const & | , |
std::filesystem::directory_options | ) |
Creates a recursive directory range.
fcppt::optional::object< Stream > fcppt::filesystem::open | ( | std::filesystem::path const & | _path, |
std::ios_base::openmode const | _openmode ) |
Opens a file, returning an optional.
Tries to open _path with _openmode and returns an empty optional on failure.
Stream | Must be a std::{basic_ifstream,basic_ofstream,basic_fstream}. |
Stream fcppt::filesystem::open_exn | ( | std::filesystem::path const & | _path, |
std::ios_base::openmode const | _openmode ) |
Opens a file, throwing an exception on failure.
Tries to open _path with _openmode and throw an exception on failure.
Stream | Must be a std::{basic_ifstream,basic_ofstream,basic_fstream}. |
Exception | Must be constructible from fcppt::string. |
FCPPT_FILESYSTEM_DETAIL_SYMBOL fcppt::string fcppt::filesystem::path_to_string | ( | std::filesystem::path const & | path | ) |
Turns a path into an fcppt::string.
Turns path into an fcppt::string.
|
nodiscard |
Removes the extension from a path.
Removes the extension (inluding the dot) from path if it has any.
path | The path to remove the extension from |