mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Update genflist tool to search recursively
This commit is contained in:
parent
b1c68734d8
commit
1a8d77ccfa
@ -2,6 +2,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QStack>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <sodium.h>
|
#include <sodium.h>
|
||||||
#include "serialize.h"
|
#include "serialize.h"
|
||||||
@ -15,6 +16,31 @@ using namespace std;
|
|||||||
///
|
///
|
||||||
/// The generated flist is very simple and just installs everything in the working directory ...
|
/// The generated flist is very simple and just installs everything in the working directory ...
|
||||||
|
|
||||||
|
QList<QString> scanDir(QDir dir)
|
||||||
|
{
|
||||||
|
QList<QString> files;
|
||||||
|
QStack<QString> stack;
|
||||||
|
stack.push(dir.absolutePath());
|
||||||
|
while (!stack.isEmpty()) {
|
||||||
|
QString sSubdir = stack.pop();
|
||||||
|
QDir subdir(sSubdir);
|
||||||
|
|
||||||
|
// Check for the files.
|
||||||
|
QList<QString> sublist = subdir.entryList(QDir::Files);
|
||||||
|
for (QString& file : sublist)
|
||||||
|
file = dir.relativeFilePath(sSubdir + '/' + file);
|
||||||
|
files += sublist;
|
||||||
|
|
||||||
|
QFileInfoList infoEntries = subdir.entryInfoList(QStringList(),
|
||||||
|
QDir::AllDirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||||
|
for (int i = 0; i < infoEntries.size(); i++) {
|
||||||
|
QFileInfo& item = infoEntries[i];
|
||||||
|
stack.push(item.absoluteFilePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
cout << "qTox updater flist generator" << endl;
|
cout << "qTox updater flist generator" << endl;
|
||||||
@ -56,7 +82,7 @@ int main(int argc, char* argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList filesListStr = sdir.entryList(QDir::Files);
|
QStringList filesListStr = scanDir(sdir);
|
||||||
|
|
||||||
/// Serialize the flist data
|
/// Serialize the flist data
|
||||||
QByteArray flistData;
|
QByteArray flistData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user