From 244b3c4e92f0909085d5068d5a8c04137068c06b Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Tue, 15 Sep 2020 15:30:19 +0300 Subject: Repogen: Fix repository generation for empty package dir Change-Id: I5be59799b399fe8bd6655fcf6d7f6efdf5aa5f53 Reviewed-by: Arttu Tarkiainen Reviewed-by: Iikka Eklund --- tools/repogen/repogen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp index 922bdfe30..236b0b901 100644 --- a/tools/repogen/repogen.cpp +++ b/tools/repogen/repogen.cpp @@ -156,11 +156,15 @@ int main(int argc, char** argv) return printErrorAndUsageAndExit(QCoreApplication::translate("QInstaller", "Error: Packages parameter missing argument")); } - - if (!QFileInfo(args.first()).exists()) { + const QDir dir(args.first()); + if (!dir.exists()) { return printErrorAndUsageAndExit(QCoreApplication::translate("QInstaller", "Error: Package directory not found at the specified location")); } + if (dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot).isEmpty()) { + return printErrorAndUsageAndExit(QCoreApplication::translate("QInstaller", + "Error: Package directory is empty")); + } packagesDirectories.append(args.first()); args.removeFirst(); -- cgit v1.2.3