KJB
|
this class creates a temporary directory under TEMP_DIR (usu. /tmp) More...
#include <l_stdio_wrap.h>
Public Member Functions | |
Temporary_Directory () | |
int | remove () |
int | recursively_remove () |
const std::string & | get_pathname () const |
get the filename of this object (if still valid) More... | |
bool | set_silence_flag (bool new_silence_setting=true) |
By default the dtor prints errors (if any) – you can suppress it. More... | |
this class creates a temporary directory under TEMP_DIR (usu. /tmp)
If the directory is empty at destruction time, this removes the directory. If the directory is not empty, this sets errno and maybe prints a message, but does not throw. If you need to clear out the directory prior to destruction then consider calling the recursively_remove() method, or use class Temporary_Recursively_Removing_Directory.
The default behavior of the class is for the destructor to print if it is unable to succeed. If you do not want the destructor to print, regardless of error status, use the method set_silence_flag(). This same method returns the prior state of the flag.
|
inline |
|
inline |
get the filename of this object (if still valid)
Iff either cleanup method has succeeded previously, then this method returns a reference to an empty string, indicating that the underlying file is gone.
|
inline |
|
inline |
|
inline |
By default the dtor prints errors (if any) – you can suppress it.
new_silence_setting | if false, and if the (future) destruction step fails, the destructor will print the relevant error message. If true, nothing will be printed. |