Small tweaks to the assets - delete extra files

This commit is contained in:
Petr Mrázek
2013-07-07 18:12:09 +02:00
parent 8f5516ceb6
commit a23323a01e
2 changed files with 37 additions and 15 deletions

View File

@@ -13,19 +13,11 @@ inline QDomElement getDomElementByTagName(QDomElement parent, QString tagname)
return QDomElement();
}
// a job that removes all files from the base folder that don't match the whitelist
// runs in whatever thread owns the queue. it is fast though.
class NukeAndPaveJob: public Job
class ThreadedDeleter : public QThread
{
Q_OBJECT
public:
explicit NukeAndPaveJob(QString base, QStringList whitelist)
:Job()
{
QDir dir(base);
m_base = dir.absolutePath();
m_whitelist = whitelist;
};
virtual void start()
void run()
{
QDirIterator iter(m_base, QDirIterator::Subdirectories);
QStringList nuke_list;
@@ -51,13 +43,37 @@ public:
f.remove();
}
}
emit finish();
};
private:
QString m_base;
QStringList m_whitelist;
};
class NukeAndPaveJob: public Job
{
Q_OBJECT
public:
explicit NukeAndPaveJob(QString base, QStringList whitelist)
:Job()
{
QDir dir(base);
deleterThread.m_base = dir.absolutePath();
deleterThread.m_whitelist = whitelist;
};
public slots:
virtual void start()
{
connect(&deleterThread, SIGNAL(finished()), SLOT(threadFinished()));
deleterThread.start();
};
void threadFinished()
{
emit finish();
}
private:
ThreadedDeleter deleterThread;
};
class DlMachine : public QObject
{
Q_OBJECT
@@ -84,7 +100,7 @@ public slots:
qDebug() << "Failed to process s3.amazonaws.com/Minecraft.Resources. XML error:" <<
xmlErrorMsg << ba;
}
QRegExp etag_match(".*([a-f0-9]{32}).*");
//QRegExp etag_match(".*([a-f0-9]{32}).*");
QDomNodeList contents = doc.elementsByTagName("Contents");
JobList *job = new JobList();