From a299207e5d43d222c6ac77d12219174becb651f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 7 Nov 2018 22:53:27 +0100 Subject: [PATCH] Use standards compliant paths for the tile chache --- src/GUI/gui.cpp | 4 +++- src/common/programpaths.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 5865e5f6..b9b3ac3e 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -699,7 +699,9 @@ void GUI::paths() + tr("POI directory:") + "" + QDir::cleanPath(ProgramPaths::poiDir(true)) + "" + tr("GCS/PCS directory:") + "" - + QDir::cleanPath(ProgramPaths::csvDir(true)) + "" + + QDir::cleanPath(ProgramPaths::csvDir(true)) + "" + + tr("Tile cache directory:") + "" + + QDir::cleanPath(ProgramPaths::tilesDir()) + "" ); msgBox.exec(); diff --git a/src/common/programpaths.cpp b/src/common/programpaths.cpp index 88dbd40c..ccb2c7a9 100644 --- a/src/common/programpaths.cpp +++ b/src/common/programpaths.cpp @@ -75,7 +75,15 @@ QString ProgramPaths::csvDir(bool writable) QString ProgramPaths::tilesDir() { - return dir(TILES_DIR, true); +#if defined(Q_OS_WIN32) + return QDir::homePath() + QString("/AppData/Local/") + + qApp->applicationName() + QString("/cache"); +#elif defined(Q_OS_MAC) + return QDir::homePath() + QString("/Library/Caches/") + + qApp->applicationName(); +#else + return QDir::homePath() + QString("/.cache/") + qApp->applicationName(); +#endif } QString ProgramPaths::translationsDir() @@ -135,7 +143,7 @@ QString ProgramPaths::csvDir(bool writable) QString ProgramPaths::tilesDir() { return QDir(QStandardPaths::writableLocation( - QStandardPaths::AppLocalDataLocation)).filePath(TILES_DIR); + QStandardPaths::CacheLocation)).filePath(TILES_DIR); } QString ProgramPaths::translationsDir()