diff --git a/DownloadDCJsonFiles/main.cpp b/DownloadDCJsonFiles/main.cpp index b044507..aa861e3 100644 --- a/DownloadDCJsonFiles/main.cpp +++ b/DownloadDCJsonFiles/main.cpp @@ -113,28 +113,31 @@ int main(int argc, char **argv) { return 0; } - QString const customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr)); - - qCritical() << "Using customer repository" << customerRepo; - - // always execute contents of opkg_commands-file + QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr)); QStringList filesToUpdate; - QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config")); - - if (dir.exists()) { - QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files); - if (!jsons.isEmpty()) { - for (QStringList::size_type i=0; i mountPath = System::checkForUSBStick(psaConfigDir); + if (mountPath.has_value()) { + filesToUpdate = System::getJsonFilesOnUsbStick(mountPath.value()); } else { - qCritical() << "DIRECTORY" << dir << "DOES NOT EXIST"; - return -1; + qCritical() << "Using customer repository" << customerRepo; + + QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config")); + if (dir.exists()) { + QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files); + if (!jsons.isEmpty()) { + for (QStringList::size_type i=0; i