Merge lp:~3v1n0/appmenu-qt5/use-xdg-runtime-dir into lp:appmenu-qt5

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 49
Merged at revision: 49
Proposed branch: lp:~3v1n0/appmenu-qt5/use-xdg-runtime-dir
Merge into: lp:appmenu-qt5
Diff against target: 20 lines (+8/-1)
1 file modified
src/iconcache.cpp (+8/-1)
To merge this branch: bzr merge lp:~3v1n0/appmenu-qt5/use-xdg-runtime-dir
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+314629@code.launchpad.net

Commit message

IconCache: use $XDG_RUNTIME_DIR as preferred place where to save icons

Now that $SNAP supports it, we can safely use it.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/iconcache.cpp'
2--- src/iconcache.cpp 2016-11-16 23:35:28 +0000
3+++ src/iconcache.cpp 2017-01-12 15:23:23 +0000
4@@ -44,8 +44,15 @@
5 {
6 if (!m_temporaryDir) {
7 QString dir;
8+ QString runtimeDir = QString::fromUtf8(getenv("XDG_RUNTIME_DIR"));
9
10- if (!getenv("SNAP")) {
11+ if (!runtimeDir.isEmpty()) {
12+ dir = runtimeDir;
13+ QDir d(dir);
14+ if (!d.exists()) {
15+ d.mkpath(".");
16+ }
17+ } else if (!getenv("SNAP")) {
18 dir = QDir::tempPath();
19 } else {
20 // Try to get the .cache from $XDG_CACHE_HOME, if it's not set,

Subscribers

People subscribed via source and target branches