Verified Commit 2d1473fe authored by Jonah Brüchert's avatar Jonah Brüchert 💬
Browse files

Make sure icon and desktop file directory exist

parent 54f06d57
......@@ -37,18 +37,30 @@ WebAppManager::WebAppManager(QObject *parent)
QString WebAppManager::desktopFileDirectory()
{
if (isFlatpak()) {
return qEnvironmentVariable("HOME") % u"/.local/share/applications/";
}
return QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
auto dir = []() -> QString {
if (isFlatpak()) {
return qEnvironmentVariable("HOME") % u"/.local/share/applications/";
}
return QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
}();
QDir(dir).mkpath(QStringLiteral("."));
return dir;
}
QString WebAppManager::iconDirectory()
{
if (isFlatpak()) {
return qEnvironmentVariable("HOME") % u"/.local/share/icons/hicolor/16x16/apps/";
}
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/icons/hicolor/16x16/apps/");
auto dir = []() -> QString {
if (isFlatpak()) {
return qEnvironmentVariable("HOME") % u"/.local/share/icons/hicolor/16x16/apps/";
}
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/icons/hicolor/16x16/apps/");
}();
QDir(dir).mkpath(QStringLiteral("."));
return dir;
}
const std::vector<WebApp> &WebAppManager::applications() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment