comparison src/debug.cpp @ 708:067252b1e732

Support Qt5 older than 5.4
author Chris Cannam
date Wed, 12 Dec 2018 11:19:42 +0000
parents af295de6a59b
children
comparison
equal deleted inserted replaced
707:3c2bdbd35ba7 708:067252b1e732
39 mutex.lock(); 39 mutex.lock();
40 if (!debug) { 40 if (!debug) {
41 prefix = new char[20]; 41 prefix = new char[20];
42 sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); 42 sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid());
43 QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback 43 QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback
44 #if QT_VERSION >= 0x050400
44 QString logDir = QStandardPaths::writableLocation 45 QString logDir = QStandardPaths::writableLocation
45 (QStandardPaths::AppDataLocation); 46 (QStandardPaths::AppDataLocation);
47 #else
48 QString logDir = QStandardPaths::writableLocation
49 (QStandardPaths::DataLocation);
50 #endif
46 if (logDir != "" && 51 if (logDir != "" &&
47 (QDir(logDir).exists() || 52 (QDir(logDir).exists() ||
48 QDir().mkpath(logDir))) { 53 QDir().mkpath(logDir))) {
49 logFileName = logDir + "/debug.log"; 54 logFileName = logDir + "/debug.log";
50 } 55 }