KTempDir Class Reference
#include <ktempdir.h>
Detailed Description
The KTempDir class creates a unique directory for temporary use.This is especially useful if you need to create a directory in a world writable directory like /tmp without being vulnerable to so called symlink attacks.
KDE applications, however, shouldn't create files or directories in /tmp in the first place but use the "tmp" resource instead. The standard KTempDir constructor will do that by default.
To create a temporary directory that starts with a certain name in the "tmp" resource, one should use: KTempDir(locateLocal("tmp", prefix));
KTempFile does not create any missing directories, but locateLocal() does.
See also KStandardDirs
- Since:
- 3.2
- Author:
- Joseph Wenninger <jowenn@kde.org>
Definition at line 53 of file ktempdir.h.
Public Member Functions | |
KTempDir (QString directoryPrefix=QString::null, int mode=0700) | |
~KTempDir () | |
void | setAutoDelete (bool autoDelete) |
int | status () const |
QString | name () const |
QDir * | qDir () |
void | unlink () |
bool | existing () const |
Static Public Member Functions | |
static bool | removeDir (const QString &path) |
Protected Member Functions | |
bool | create (const QString &directoryPrefix, int mode) |
void | setError (int error) |
Constructor & Destructor Documentation
|
Creates a temporary directory with the name:
The default
Definition at line 59 of file ktempdir.cpp. |
|
The destructor deletes the directory and it's contents if autoDelete is enabled.
Definition at line 106 of file ktempdir.cpp. |
Member Function Documentation
|
Creates a "random" directory with specified mode.
Definition at line 72 of file ktempdir.cpp. |
|
Definition at line 125 of file ktempdir.cpp. |
|
Returns the full path and name of the directory, including a trailing '/'.
Definition at line 119 of file ktempdir.cpp. |
|
Returns the QDir* of the temporary directory.
Definition at line 131 of file ktempdir.cpp. |
|
Remove a directory and all its contents. Remove recursively a directory, even if it is not empty or contains other directories.
However the function works too when the The function stops on the first error.
Definition at line 205 of file ktempdir.cpp. |
|
Turn automatic deletion on or off. Automatic deletion is off by default.
Definition at line 85 of file ktempdir.h. |
|
Sets the errno value.
Definition at line 161 of file ktempdir.h. |
|
Returns the status of the directory creation based on errno. (see errno.h) 0 means OK. You should check the status after object creation to check whether a directory could be created in the first place.
Definition at line 113 of file ktempdir.cpp. |
|
Deletes the directory recursively.
Definition at line 138 of file ktempdir.cpp. |
The documentation for this class was generated from the following files: