mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Update main.cpp to update Linux user's icon for AppImage deployments
This commit is contained in:
parent
9b9924784a
commit
d62da9416a
@ -207,27 +207,23 @@ static void setupAppImageIcon(const QString &appExecutableName,
|
|||||||
const QString pixmapFile = pixmapPath + appExecutableName + ".png";
|
const QString pixmapFile = pixmapPath + appExecutableName + ".png";
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Check if the icon file already exists to avoid redundant copying
|
// Ensure the directory exists; create it if it doesn't
|
||||||
if (!QFileInfo::exists(pixmapFile))
|
QDir dir;
|
||||||
|
if (!dir.exists(pixmapPath) && !dir.mkpath(pixmapPath))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Copy the icon from resources to the destination
|
||||||
|
QFile resourceFile(iconResourcePath);
|
||||||
|
if (resourceFile.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
// Ensure the directory exists; create it if it doesn't
|
QFile localFile(pixmapFile);
|
||||||
QDir dir;
|
if (localFile.open(QIODevice::WriteOnly))
|
||||||
if (!dir.exists(pixmapPath) && !dir.mkpath(pixmapPath))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Copy the icon from resources to the destination
|
|
||||||
QFile resourceFile(iconResourcePath);
|
|
||||||
if (resourceFile.open(QIODevice::ReadOnly))
|
|
||||||
{
|
{
|
||||||
QFile localFile(pixmapFile);
|
localFile.write(resourceFile.readAll());
|
||||||
if (localFile.open(QIODevice::WriteOnly))
|
localFile.close();
|
||||||
{
|
|
||||||
localFile.write(resourceFile.readAll());
|
|
||||||
localFile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
resourceFile.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resourceFile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user