82            INT << 
"TmpPath cleanup error (" << res << 
") " << p << endl;
 
   84            DBG << 
"TmpPath cleaned up " << p << endl;
 
 
 
  123    :
_impl( tmpPath_r.empty() ? nullptr : new 
Impl( 
std::move(tmpPath_r) ) )
 
 
  165      static Pathname p( getenv(
"ZYPPTMPDIR") ? getenv(
"ZYPPTMPDIR") : 
"/var/tmp" );
 
 
  170    { 
return _impl.get() ? 
_impl->autoCleanup() : 
false; }
 
 
  173    { 
if ( 
_impl.get() ) 
_impl->autoCleanup( yesno_r ); }
 
 
  188                      const std::string & prefix_r )
 
  193        ERR << 
"Parent directory '" << inParentDir_r << 
"' can't be created." << endl;
 
  198      Pathname tmpPath = (inParentDir_r + prefix_r).extend( 
"XXXXXX");
 
  202          ERR << 
"Out of memory" << endl;
 
  206      int tmpFd = ::mkostemp( buf, O_CLOEXEC );
 
  214        ERR << 
"Cant create '" << buf << 
"' " << ::strerror( errno ) << endl;
 
 
  233        } 
else if ( mode != -1U ) {
 
 
  261      static std::string p( 
"TmpFile." );
 
 
  277                    const std::string & prefix_r )
 
  282        ERR << 
"Parent directory '" << inParentDir_r << 
"' can't be created." << endl;
 
  287      Pathname tmpPath = (inParentDir_r + prefix_r).extend( 
"XXXXXX");
 
  291          ERR << 
"Out of memory" << endl;
 
  295      char * tmp = ::mkdtemp( buf );
 
  300        ERR << 
"Cant create '" << tmpPath << 
"' " << ::strerror( errno ) << endl;
 
 
  319        } 
else if ( mode != -1U ) {
 
 
  334      static std::string p( 
"TmpDir." );
 
 
  343    return _tmpdir.
path();
 
 
Base class for reference counted objects.
Wrapper class for stat/lstat.
bool isExist() const
Return whether valid stat info exists.
Pathname dirname() const
Return all but the last component od this path.
const char * c_str() const
String representation.
const std::string & asString() const
String representation.
std::string basename() const
Return the last component of this path.
Provide a new empty temporary directory and recursively delete it when no longer needed.
static const std::string & defaultPrefix()
TmpDir(const Pathname &inParentDir_r=defaultLocation(), const std::string &prefix_r=defaultPrefix())
Ctor.
static TmpDir makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
Provide a new empty temporary file and delete it when no longer needed.
TmpFile(const Pathname &inParentDir_r=defaultLocation(), const std::string &prefix_r=defaultPrefix())
Ctor.
static TmpFile makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
static ManagedFile asManagedFile()
Create a temporary file and convert it to a automatically cleaned up ManagedFile.
static const std::string & defaultPrefix()
Clean or delete a directory on destruction.
Impl & operator=(const Impl &)=delete
void autoCleanup(bool yesno_r)
Impl(Pathname &&path_r, Flags flags_r=CtorDefault)
Impl & operator=(Impl &&)=delete
Impl(const Impl &)=delete
const Pathname & path() const
static const Pathname & defaultLocation()
bool autoCleanup() const
Whether path is valid and deleted when the last reference drops.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Types and functions for filesystem operations.
int chmod(const Pathname &path, mode_t mode)
Like 'chmod'.
mode_t applyUmaskTo(mode_t mode_r)
Modify mode_r according to the current umask ( mode_r & ~getUmask() ).
int recursive_rmdir(const Pathname &path)
Like 'rm -r DIR'.
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
int unlink(const Pathname &path)
Like 'unlink'.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Easy-to use interface to the ZYPP dependency resolver.
Pathname myTmpDir()
Global access to the zypp.TMPDIR (created on demand, deleted when libzypp is unloaded)
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Wrapper for const correct access via Smart pointer types.