A safe guard to manage a filesystem entry, e.g. a file or a directory.
More...
#include <seqan3/io/detail/safe_filesystem_entry.hpp>
A safe guard to manage a filesystem entry, e.g. a file or a directory.
This raii-wrapper class allows for a safe removal of a created filesystem entry such as a directory or file. This wrapper class assumes owning semantics. It is not copy-constructible or copy-assignable. In order to prevent misuse also the default constructor is deleted.
The following example demonstrates the use case.
#include <filesystem>
int main()
{
file_guard.remove();
}
A safe guard to manage a filesystem entry, e.g. a file or a directory.
Definition: safe_filesystem_entry.hpp:38
Provides seqan3::detail::safe_filesystem_entry.
T temp_directory_path(T... args)
◆ safe_filesystem_entry()
Constructs the safe guard from a std::filesystem::path.
- Parameters
-
p | The path pointing to a filesystem entry. |
◆ remove()
bool seqan3::detail::safe_filesystem_entry::remove |
( |
| ) |
|
|
inline |
◆ remove_all()
Removes a file or directory and all its contents, recursively.
- Returns
- Returns the number of files and directories that were deleted (which may be zero if p did not exist to begin with).
- Exceptions
-
Internally calls std::filesystem::remove_all on the stored std::filesystem::path.
◆ remove_no_throw()
bool seqan3::detail::safe_filesystem_entry::remove_no_throw |
( |
| ) |
const |
|
inlinenoexcept |
The documentation for this class was generated from the following file: