From 559237f930fbd42d1b715d78cc78e1d214daf000 Mon Sep 17 00:00:00 2001 From: jerry Date: Wed, 18 Jun 2014 12:59:30 +0000 Subject: [PATCH] issue #3404 - Log path needs to be in quotes on windows issue solved. --- src/gui/src/AppConfig.cpp | 10 ++++++++++ src/gui/src/AppConfig.h | 1 + src/gui/src/MainWindow.cpp | 9 ++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index 95e5484d..3ba0d2db 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -93,6 +93,16 @@ void AppConfig::persistLogDir() } } +const QString logFilenameCmd() const +{ + QString filename = m_LogFilename; +#if defined(Q_OS_WIN) + // wrap in quotes in case username contains spaces. + filename = QString("\"%1\"").arg(filename); +#endif + return filename; +} + QString AppConfig::logLevelText() const { return logLevelNames[logLevel()]; diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 51c1128d..4b962186 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -59,6 +59,7 @@ class AppConfig int logLevel() const { return m_LogLevel; } bool logToFile() const { return m_LogToFile; } const QString& logFilename() const { return m_LogFilename; } + const QString logFilenameCmd() const; QString logLevelText() const; const QString& cryptoPass() const { return m_CryptoPass; } bool cryptoEnabled() const { return m_CryptoEnabled; } diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index a06141ed..555d62f3 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -508,7 +508,7 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) if (appConfig().logToFile()) { appConfig().persistLogDir(); - args << "--log" << appConfig().logFilename(); + args << "--log" << appConfig().logFilenameCmd(); } args << m_pLineEditHostname->text() + ":" + QString::number(appConfig().port()); @@ -581,12 +581,7 @@ bool MainWindow::serverArgs(QStringList& args, QString& app) { appConfig().persistLogDir(); - QString logFilename = appConfig().logFilename(); -#if defined(Q_OS_WIN) - // wrap in quotes in case username contains spaces. - logFilename = QString("\"%1\"").arg(logFilename); -#endif - args << "--log" << logFilename; + args << "--log" << appConfig().logFilenameCmd(); } QString configFilename = this->configFilename();