From 534f1cf79a34f77a3989083a6fb73265c01ac6ef Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Sat, 28 Oct 2017 21:51:41 +0200 Subject: [PATCH] Fix: Check if desktop file from first argument really exists and issue a proper error message if not. When using linuxdeployqt for example in OBS and packages can not be installed, it can happen that the desktop file is not existing. This error message makes debugging easier. --- tools/linuxdeployqt/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/linuxdeployqt/main.cpp b/tools/linuxdeployqt/main.cpp index e438fa9..e51bae1 100644 --- a/tools/linuxdeployqt/main.cpp +++ b/tools/linuxdeployqt/main.cpp @@ -88,6 +88,12 @@ int main(int argc, char **argv) * to do when using linuxdeployqt. */ if (firstArgument.endsWith(".desktop")){ qDebug() << "Desktop file as first argument:" << firstArgument; + + /* Check if the desktop file really exists */ + if (! QFile::exists(firstArgument)) { + LogError() << "Desktop file in first argument does not exist!"; + return 1; + } QSettings * settings = 0; settings = new QSettings(firstArgument, QSettings::IniFormat); desktopExecEntry = settings->value("Desktop Entry/Exec", "r").toString().split(' ').first().split('/').last().trimmed();