From b830f1f8cdc1528ef606f41d305cc26da16d3549 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 27 Feb 2017 09:20:55 +0100 Subject: [PATCH] Beginnings of icon copying --- linuxdeployqt/main.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/linuxdeployqt/main.cpp b/linuxdeployqt/main.cpp index 0a509ff..ba03ae0 100644 --- a/linuxdeployqt/main.cpp +++ b/linuxdeployqt/main.cpp @@ -88,7 +88,7 @@ int main(int argc, char **argv) desktopExecEntry = settings->value("Desktop Entry/Exec", "r").toString().split(' ').first().split('/').last().trimmed(); qDebug() << "desktopExecEntry:" << desktopExecEntry; desktopFile = firstArgument; - desktopIconEntry = settings->value("Desktop Entry/Icon", "r").toString().split(' ').first().trimmed(); + desktopIconEntry = settings->value("Desktop Entry/Icon", "r").toString().split(' ').first().split('.').first().trimmed(); qDebug() << "desktopIconEntry:" << desktopIconEntry; QString candidateBin = QDir::cleanPath(QFileInfo(firstArgument).absolutePath() + desktopExecEntry); // Not FHS-like @@ -219,6 +219,28 @@ int main(int argc, char **argv) } } + /* To make an AppDir, we need to find the icon and copy it in place */ + QStringList candidates; + QString iconToBeUsed = ""; + if(desktopIconEntry != ""){ + QDirIterator it3(appDirPath, QDirIterator::Subdirectories); + while (it3.hasNext()) { + it3.next(); + if((it3.fileName().startsWith(desktopIconEntry)) && ((it3.fileName().endsWith(".png")) || (it3.fileName().endsWith(".svg")) || (it3.fileName().endsWith(".svgz")) || (it3.fileName().endsWith(".xpm")))){ + candidates.append(it3.filePath()); + } + } + qDebug() << "Found icons from desktop file:" << candidates; + if(candidates.length() == 1){ + iconToBeUsed = candidates.at(0); // The only choice + } + + /* Copy in place */ + if(iconToBeUsed != ""){ + /* Check if there is already an icon and only if there is not, copy it to the AppDir */ + } + } + for (int i = 2; i < argc; ++i) { QByteArray argument = QByteArray(argv[i]); if (argument == QByteArray("-no-plugins")) {