Use QStandardPaths::AppLocalDataLocation in the runtime to determine where to store runtime logs. Fixes #5414

This commit is contained in:
Dave Page 2020-07-11 16:32:08 +05:30 committed by Akshay Joshi
parent 29175d7ec4
commit 6855ac1d5e
4 changed files with 12 additions and 5 deletions

View File

@ -27,6 +27,7 @@ Bug fixes
| `Issue #3851 <https://redmine.postgresql.org/issues/3851>`_ - Add proper indentation to the code while generating functions, procedures, and trigger functions.
| `Issue #4235 <https://redmine.postgresql.org/issues/4235>`_ - Fixed tab indent issue on a selection of lines is deleting the content when 'use spaces == true' in the preferences.
| `Issue #5287 <https://redmine.postgresql.org/issues/5287>`_ - Fixed dark theme-related CSS and modify the color codes.
| `Issue #5414 <https://redmine.postgresql.org/issues/5414>`_ - Use QStandardPaths::AppLocalDataLocation in the runtime to determine where to store runtime logs.
| `Issue #5463 <https://redmine.postgresql.org/issues/5463>`_ - Fixed an issue where CSV download quotes numeric columns.
| `Issue #5470 <https://redmine.postgresql.org/issues/5470>`_ - Fixed backgrid row hover issue where on hover background color is set for edit and delete cell only.
| `Issue #5530 <https://redmine.postgresql.org/issues/5530>`_ - Ensure that the referenced table should be displayed on foreign key constraints.

View File

@ -35,9 +35,14 @@ void LogWindow::LoadLog()
int startupLines;
int serverLines;
QString startup_log = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" ");
ui->lblStatus->setText(tr("Loading logfiles..."));
startupLines = this->readLog(QDir::homePath() + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" "), ui->textStartupLog);
ui->lblStartupLog->setText(tr("Startup Log (%1):").arg(startup_log));
ui->lblServerLog->setText(tr("Server Log (%1):").arg(m_serverLogFile));
startupLines = this->readLog(startup_log, ui->textStartupLog);
serverLines = this->readLog(m_serverLogFile, ui->textServerLog);
ui->lblStatus->setText(QString(tr("Loaded startup log (%1 lines) and server log (%2 lines).")).arg(startupLines).arg(serverLines));

View File

@ -27,7 +27,7 @@ Logger* Logger::GetLogger()
if (m_pThis == Q_NULLPTR)
{
m_pThis = new Logger();
m_sFileName = QDir::homePath() + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" ");
m_sFileName = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" ");
m_Logfile = new QFile;
m_Logfile->setFileName(m_sFileName);
m_Logfile->open(QIODevice::WriteOnly | QIODevice::Text);

View File

@ -109,11 +109,12 @@ int main(int argc, char * argv[])
#endif
// Create a hash of the executable path so we can run copies side-by-side
QString homeDir = QDir::homePath();
unsigned long exeHash = sdbm(reinterpret_cast<unsigned char *>(argv[0]));
// Create the address file, that will be used to store the appserver URL for this instance
addrFileName = homeDir + (QString("/.%1.%2.addr").arg(PGA_APP_NAME).arg(exeHash)).remove(" ");
QDir workdir;
workdir.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
addrFileName = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.%2.addr").arg(PGA_APP_NAME).arg(exeHash)).remove(" ");
QFile addrFile(addrFileName);
// Create a system-wide semaphore keyed by app name, exe hash and the username
@ -250,7 +251,7 @@ int main(int argc, char * argv[])
key = key.mid(1, key.length() - 2);
// Generate the filename for the log
logFileName = homeDir + (QString("/.%1.%2.log").arg(PGA_APP_NAME).arg(exeHash)).remove(" ");
logFileName = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.%2.log").arg(PGA_APP_NAME).arg(exeHash)).remove(" ");
// Create Menu Actions
MenuActions *menuActions = new MenuActions();