aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2016-01-29 19:26:05 +0100
committerJohannes Schickel2016-02-02 09:16:40 +0100
commit79acfd28e9e774631f2e0af2bba34a3c0de9b40f (patch)
treec281fa83c68fa6890d7d7f12a2adaa5d38c50e14
parentb4e360188f49cda286a3a707e87fa41b437cd179 (diff)
downloadscummvm-rg350-79acfd28e9e774631f2e0af2bba34a3c0de9b40f.tar.gz
scummvm-rg350-79acfd28e9e774631f2e0af2bba34a3c0de9b40f.tar.bz2
scummvm-rg350-79acfd28e9e774631f2e0af2bba34a3c0de9b40f.zip
POSIX: Use modern path for log file.
This makes use use the XDG Base Directory Specification for the log file path. This tackles one part of bug #6036 "POSIX: Use XDG dirs instead of HOME".
-rw-r--r--backends/platform/sdl/posix/posix.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 8b065e131a..4812d34a5a 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -180,12 +180,20 @@ Common::WriteStream *OSystem_POSIX::createLogFile() {
prefix = nullptr;
logFile = "/mtd_ram";
#else
- prefix = getenv("HOME");
- if (prefix == nullptr) {
- return 0;
+ // On POSIX systems we follow the XDG Base Directory Specification for
+ // where to store files. The version we based our code upon can be found
+ // over here: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
+ prefix = getenv("XDG_CACHE_HOME");
+ if (prefix == nullptr || !*prefix) {
+ prefix = getenv("HOME");
+ if (prefix == nullptr) {
+ return 0;
+ }
+
+ logFile = ".cache/";
}
- logFile = ".scummvm/logs";
+ logFile += "scummvm/logs";
#endif
if (!assureDirectoryExists(logFile, prefix)) {