changeset 689:af295de6a59b

Ensure debug log is always created, in %AppData%
author Chris Cannam
date Mon, 10 Dec 2018 10:28:15 +0000
parents 8ec848c6a4b4
children bfafe078df9a
files src/debug.cpp src/debug.h
diffstat 2 files changed, 3 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/debug.cpp	Sun Dec 09 16:46:44 2018 +0000
+++ b/src/debug.cpp	Mon Dec 10 10:28:15 2018 +0000
@@ -42,7 +42,7 @@
         sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid());
         QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback
         QString logDir = QStandardPaths::writableLocation
-            (QStandardPaths::DataLocation);
+            (QStandardPaths::AppDataLocation);
         if (logDir != "" &&
             (QDir(logDir).exists() ||
              QDir().mkpath(logDir))) {
--- a/src/debug.h	Sun Dec 09 16:46:44 2018 +0000
+++ b/src/debug.h	Mon Dec 10 10:28:15 2018 +0000
@@ -15,8 +15,8 @@
     COPYING included with this distribution for more information.
 */
 
-#ifndef _DEBUG_H_
-#define _DEBUG_H_
+#ifndef EASYHG_DEBUG_H
+#define EASYHG_DEBUG_H
 
 #include <QDebug>
 #include <QTextStream>
@@ -30,8 +30,6 @@
 std::ostream &operator<<(std::ostream &, const QString &);
 std::ostream &operator<<(std::ostream &, const QUrl &);
 
-#ifndef NDEBUG
-
 extern QDebug &getEasyHgDebug();
 
 #define DEBUG getEasyHgDebug()
@@ -45,23 +43,5 @@
     return d;
 }
 
-#else
-
-class NoDebug
-{
-public:
-    inline NoDebug() {}
-    inline ~NoDebug(){}
-
-    template <typename T>
-    inline NoDebug &operator<<(const T &) { return *this; }
-
-    inline NoDebug &operator<<(QTextStreamFunction) { return *this; }
-};
-
-#define DEBUG NoDebug()
-
-#endif /* !NDEBUG */
-
 #endif /* !_DEBUG_H_ */