From 6ee83c99d95e0ea122b0831e7e520708eccddb91 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Wed, 5 May 2021 17:58:56 +0300 Subject: [PATCH] UI: AppInfoUtil: Handle app's empty FileDescription. --- src/ui/appinfo/appinfoutil.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ui/appinfo/appinfoutil.cpp b/src/ui/appinfo/appinfoutil.cpp index 4e0d46f7..760e1056 100644 --- a/src/ui/appinfo/appinfoutil.cpp +++ b/src/ui/appinfo/appinfoutil.cpp @@ -112,9 +112,15 @@ bool extractVersionInfo(const QString &appPath, AppInfo &appInfo) return false; // Texts - appInfo.productName = extractInfoText(infoData, langInfo, L"ProductName"); appInfo.companyName = extractInfoText(infoData, langInfo, L"CompanyName"); - appInfo.fileDescription = extractInfoText(infoData, langInfo, L"FileDescription"); + + const QString productName = extractInfoText(infoData, langInfo, L"ProductName"); + appInfo.productName = productName; + + const QString fileDescription = extractInfoText(infoData, langInfo, L"FileDescription"); + appInfo.fileDescription = !fileDescription.isEmpty() + ? fileDescription + : (!productName.isEmpty() ? productName : FileUtil::fileName(appPath)); return true; } @@ -128,10 +134,8 @@ bool getInfo(const QString &appPath, AppInfo &appInfo) if (appPath.isEmpty()) return false; - appInfo.fileDescription = FileUtil::fileName(appPath); - if (FileUtil::isSystemApp(appPath)) { - appInfo.fileDescription = appPath; + appInfo.fileDescription = FileUtil::systemApp(); return true; }