comparison src/debug.cpp @ 689:af295de6a59b

Ensure debug log is always created, in %AppData%
author Chris Cannam
date Mon, 10 Dec 2018 10:28:15 +0000
parents f9b805d8cab4
children 067252b1e732
comparison
equal deleted inserted replaced
688:8ec848c6a4b4 689:af295de6a59b
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 QString logDir = QStandardPaths::writableLocation 44 QString logDir = QStandardPaths::writableLocation
45 (QStandardPaths::DataLocation); 45 (QStandardPaths::AppDataLocation);
46 if (logDir != "" && 46 if (logDir != "" &&
47 (QDir(logDir).exists() || 47 (QDir(logDir).exists() ||
48 QDir().mkpath(logDir))) { 48 QDir().mkpath(logDir))) {
49 logFileName = logDir + "/debug.log"; 49 logFileName = logDir + "/debug.log";
50 } 50 }