diff mbox series

[v2,8/8] kernel-shark: Use XDG compliant path when saving cached data

Message ID 20190502124009.32208-9-ykaradzhov@vmware.com (mailing list archive)
State Superseded
Headers show
Series Modifications needed for KS 1.0 | expand

Commit Message

Yordan Karadzhov May 2, 2019, 12:40 p.m. UTC
Use the QStandardPaths class provided by Qt in order to guarantee that
the location of the cached data is XDG compliant.

Suggested-by: Troy Engel <troyengel@gmail.com>
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/src/KsMainWindow.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 5f326f5..bb593bd 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -409,8 +409,10 @@  QString KsMainWindow::_getCacheDir()
 		if (!QDir(dir).exists())
 			lamMakePath(true);
 	} else {
-		dir = QString(QDir::homePath()) +
-		      "/.cache/kernelshark";
+		auto appCachePath = QStandardPaths::GenericCacheLocation;
+		dir = QStandardPaths::writableLocation(appCachePath);
+		dir += "/kernelshark";
+
 		if (!QDir(dir).exists())
 			lamMakePath(false);
 	}