#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);
    }
}
