libzypp: zypp::filesystem::TmpDir Class Reference

libzypp 17.38.10

zypp::filesystem::TmpDir Class Reference

Provide a new empty temporary directory and recursively delete it when no longer needed. More...

`#include <zypp-core/fs/TmpPath.h>`

Inheritance diagram for zypp::filesystem::TmpDir:

## Public Member Functions
| TmpDir (const Pathname &inParentDir_r=defaultLocation(), const std::string &prefix_r=defaultPrefix())
| Ctor.
Public Member Functions inherited from zypp::filesystem::TmpPath
| TmpPath ()
| Default Ctor.
| TmpPath (Pathname tmpPath_r)
| Ctor.
virtual | ~TmpPath ()
| Dtor.
| operator bool () const
| Test whether the Pathname is valid (i.e.
Pathname | path () const
| operator Pathname () const
| Type conversion to Pathname.
bool | autoCleanup () const
| Whether path is valid and deleted when the last reference drops.
void | autoCleanup (bool yesno_r)
| Turn autoCleanup on/off if path is valid.

## Static Public Member Functions
static TmpDir | makeSibling (const Pathname &sibling_r)
| Provide a new empty temporary directory as sibling.
static TmpDir | makeSibling (const Pathname &sibling_r, unsigned mode)
static const std::string & | defaultPrefix ()
Static Public Member Functions inherited from zypp::filesystem::TmpPath
static const Pathname & | defaultLocation ()

## Additional Inherited Members
Protected Attributes inherited from zypp::filesystem::TmpPath
RW_pointer< Impl > | _impl

## Detailed Description

Provide a new empty temporary directory and recursively delete it when no longer needed.

The temporary directory is per default created in TmpPath::defaultLocation and named 'TmpDir.XXXXXX', with XXXXXX replaced by a string which makes the name unique. Different location and file prefix may be passed to the ctor. TmpDir is created with mode 0700.

TmpDir provides the Pathname of the temporary directory , or an empty path in case of any error.

Definition at line 172 of file TmpPath.h.

## Constructor & Destructor Documentation

## ◆ TmpDir()

zypp::filesystem::TmpDir::TmpDir | ( | const Pathname & | inParentDir_r = defaultLocation(),
|  | const std::string & | prefix_r = defaultPrefix() )
| explicit

Ctor.

Takes a Pathname.

Definition at line 223 of file TmpPath.cc.

## Member Function Documentation

## ◆ makeSibling() [1/2]

TmpDir zypp::filesystem::TmpDir::makeSibling | ( | const Pathname & | sibling_r | ) |
| static

Provide a new empty temporary directory as sibling.

TmpDir s = makeSibling( "/var/lib/mydir" );
// returns: /var/lib/mydir.XXXXXX
zypp::filesystem::TmpDir::TmpDir
TmpDir(const Pathname &inParentDir_r=defaultLocation(), const std::string &prefix_r=defaultPrefix())
Ctor.
Definition TmpPath.cc:223
zypp::filesystem::TmpDir::makeSibling
static TmpDir makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
Definition TmpPath.cc:250

If `sibling_r` exists, sibling is created using the same mode.

Definition at line 250 of file TmpPath.cc.

## ◆ makeSibling() [2/2]

TmpDir zypp::filesystem::TmpDir::makeSibling | ( | const Pathname & | sibling_r,
|  | unsigned | mode )
| static

Definition at line 253 of file TmpPath.cc.

## ◆ defaultPrefix()

const std::string & zypp::filesystem::TmpDir::defaultPrefix | ( |  | ) |
| static

Returns
  The default prefix for temporary directories (TmpDir.)

Definition at line 268 of file TmpPath.cc.

The documentation for this class was generated from the following files:

- zypp-core/fs/TmpPath.h
- zypp-core/fs/TmpPath.cc