Also generate .DirIcon

This commit is contained in:
probonopd
2017-02-27 19:05:22 +01:00
parent 99cde6bf77
commit e7c13e99ad
+7 -1
View File
@@ -278,19 +278,24 @@ int main(int argc, char **argv)
/* Copy in place */ /* Copy in place */
if(iconToBeUsed != ""){ if(iconToBeUsed != ""){
/* Check if there is already an icon and only if there is not, copy it to the AppDir */ /* Check if there is already an icon and only if there is not, copy it to the AppDir.
* As per the ROX AppDir spec, also copying to .DirIcon. */
QString preExistingToplevelIcon = ""; QString preExistingToplevelIcon = "";
if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".xpm").exists() == true){ if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".xpm").exists() == true){
preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".xpm"; preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".xpm";
QFile::copy(preExistingToplevelIcon, appDirPath + "/.DirIcon");
} }
if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".svgz").exists() == true){ if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".svgz").exists() == true){
preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".svgz"; preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".svgz";
QFile::copy(preExistingToplevelIcon, appDirPath + "/.DirIcon");
} }
if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".svg").exists() == true){ if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".svg").exists() == true){
preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".svg"; preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".svg";
QFile::copy(preExistingToplevelIcon, appDirPath + "/.DirIcon");
} }
if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".png").exists() == true){ if(QFileInfo(appDirPath + "/" + desktopIconEntry + ".png").exists() == true){
preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".png"; preExistingToplevelIcon = appDirPath + "/" + desktopIconEntry + ".png";
QFile::copy(preExistingToplevelIcon, appDirPath + "/.DirIcon");
} }
if(preExistingToplevelIcon != ""){ if(preExistingToplevelIcon != ""){
@@ -300,6 +305,7 @@ int main(int argc, char **argv)
QString targetIconPath = appDirPath + "/" + QFileInfo(iconToBeUsed).fileName(); QString targetIconPath = appDirPath + "/" + QFileInfo(iconToBeUsed).fileName();
if (QFile::copy(iconToBeUsed, targetIconPath)){ if (QFile::copy(iconToBeUsed, targetIconPath)){
qDebug() << "Copied" << iconToBeUsed << "to" << targetIconPath; qDebug() << "Copied" << iconToBeUsed << "to" << targetIconPath;
QFile::copy(targetIconPath, appDirPath + "/.DirIcon");
} else { } else {
LogError() << "Could not copy" << iconToBeUsed << "to" << targetIconPath << "\n"; LogError() << "Could not copy" << iconToBeUsed << "to" << targetIconPath << "\n";
exit(1); exit(1);