System::getJsonFilesOnUsbStick(): return list of JSON files for configured
directory under mount path.
This commit is contained in:
parent
4536284f34
commit
90e4e21391
@ -332,6 +332,27 @@ QString System::getUSBMountPath(QString const &dirPathUnderMountPath) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList System::getJsonFilesOnUsbStick(QString const &mountPath) {
|
||||||
|
QStringList jsonFiles;
|
||||||
|
|
||||||
|
// /media/sda2/etc/psa_config
|
||||||
|
QString const &dirPath = QDir::cleanPath(mountPath + QDir::separator() + "etc" + QDir::separator() + "psa_config");
|
||||||
|
QDir d(dirPath);
|
||||||
|
if (d.exists()) {
|
||||||
|
QDirIterator it(dirPath, QStringList() << "*.json", QDir::Files, QDirIterator::NoIteratorFlags);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
QString const &jsonFile = it.next();
|
||||||
|
QFileInfo fi(jsonFile);
|
||||||
|
if (System::allowedJsonFiles.contains(fi.fileName())) {
|
||||||
|
jsonFiles << jsonFile;
|
||||||
|
} else {
|
||||||
|
qCritical() << "Warning:" << fi.fileName() << "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return jsonFiles;
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* static function to check if a mounted sd-card is writable.
|
* static function to check if a mounted sd-card is writable.
|
||||||
|
Loading…
Reference in New Issue
Block a user