path() const
{ return _path; }
+ bool autoCleanup() const
+ { return( _flags & Autodelete ); }
+
+ void autoCleanup( bool yesno_r )
+ { _flags = yesno_r ? CtorDefault : NoOp; }
+
private:
Pathname _path;
Flags _flags;
static Pathname p( getenv("ZYPPTMPDIR") ? getenv("ZYPPTMPDIR") : "/var/tmp" );
return p;
}
+
+ bool TmpPath::autoCleanup() const
+ { return _impl.get() ? _impl->autoCleanup() : false; }
+
+ void TmpPath::autoCleanup( bool yesno_r )
+ { if ( _impl.get() ) _impl->autoCleanup( yesno_r ); }
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : TmpFile
* repesentation.
*
* When the last reference drops any file or directory located at the path
- * passed to the ctor is deleted (recursivly in case of directories).
+ * passed to the ctor is deleted (recursivly in case of directories). This
+ * behavior can be canged by calling \ref autoCleanup.
*
* Principally serves as base class, but standalone usable.
**/
operator Pathname() const
{ return path(); }
+ /**
+ * Whether path is valid and deleted when the last reference drops.
+ */
+ bool autoCleanup() const;
+
+ /**
+ * Turn \ref autoCleanup on/off if path is valid.
+ */
+ void autoCleanup( bool yesno_r );
+
public:
/**
* @return The default directory where temporary