Skip to content

Commit 15dae5f

Browse files
tfembyjohanmalm
authored andcommitted
main: Fix "qt.svg: Cannot open file" mesage
Signed-off-by: Daniella Kicsak <[email protected]>
1 parent 818c98b commit 15dae5f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <QApplication>
44
#include <QLibraryInfo>
55
#include <QTranslator>
6+
#include <QFileInfo>
67

78
static void initLocale(QTranslator *qtTranslator, QTranslator *translator)
89
{
@@ -52,9 +53,8 @@ int main(int argc, char *argv[])
5253
QString icoLocalPath = QCoreApplication::applicationDirPath() + iconSuffix;
5354
QString icoSysPath = QStringLiteral(PROJECT_ICON_SYSTEM_PATH) + iconSuffix;
5455

55-
QIcon appIcon = QIcon(icoLocalPath);
56-
if (appIcon.isNull())
57-
appIcon = QIcon(icoSysPath);
56+
// If icoLocalPath exists, set to icolocalPath; else set to icoSysPath
57+
QIcon appIcon = (QFileInfo(icoLocalPath).exists()) ? QIcon(icoLocalPath) : QIcon(icoSysPath);
5858

5959
w.setWindowIcon(appIcon);
6060

0 commit comments

Comments
 (0)