[go: up one dir, main page]

Menu

[r6]: / trunk / miscutils.cpp  Maximize  Restore  History

Download this file

24 lines (20 with data), 531 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "miscutils.h"
#include <QDir>
#include <QFile>
#include <QDebug>
void deltree(const QString &name)
{
QFileInfo info(name);
if (info.isDir()) {
QDir dir(name);
QFileInfoList list = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files);
foreach (QFileInfo file, list) {
deltree(file.absoluteFilePath());
}
QString n = dir.dirName();
dir.cdUp();
dir.rmdir(n);
} else {
QFile::remove(name);
}
}