From 8ae01fae3f787da9d9498d1406a57a4130734a1b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 9 Aug 2018 23:54:44 -0700 Subject: [PATCH] Place logs in /tmp on macOS --- app/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/main.cpp b/app/main.cpp index 4d9244ae..1f6a4dca 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -132,7 +132,13 @@ int main(int argc, char *argv[]) { #ifdef USE_CUSTOM_LOGGER #ifdef LOG_TO_FILE +#ifdef Q_OS_DARWIN + // On macOS, $TMPDIR is some random folder under /var/folders/ that nobody can + // easily find, so use the system's global tmp directory instead. + QDir tempDir("/tmp"); +#else QDir tempDir(QDir::tempPath()); +#endif s_LoggerFile = new QFile(tempDir.filePath(QString("Moonlight-%1.log").arg(QDateTime::currentSecsSinceEpoch()))); if (s_LoggerFile->open(QIODevice::WriteOnly)) { qInfo() << "Redirecting log output to " << s_LoggerFile->fileName();