From 2d6d482f2de9689fcc4546d9ca55999d0de9fb97 Mon Sep 17 00:00:00 2001 From: Vasily Date: Mon, 11 Mar 2019 11:32:44 +0100 Subject: [PATCH] Refactor log file location to use application strings --- src/utils/setup.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/utils/setup.cpp b/src/utils/setup.cpp index 93f0079..3eab7d2 100644 --- a/src/utils/setup.cpp +++ b/src/utils/setup.cpp @@ -272,18 +272,13 @@ void setUpLogging() conf.set( Level::Trace, ConfigurationType::Enabled, confDisabled ); conf.set( Level::Debug, ConfigurationType::Enabled, confDisabled ); - // This places the log file in - // Roaming/AppData/matzman666/OpenVRAdvancedSettings/AdvancedSettings.log. - // The log file placement has been broken since at least git tag "v2.7". - // It was being placed in the working dir of the executable. - // The change hasn't been documented anywhere, so it is likely that it was - // unintentional. This fixes the probable regression until a new path is - // decided on. - constexpr auto appDataFolders = "/matzman666/OpenVRAdvancedSettings"; - const QString logFilePath = QDir( QStandardPaths::writableLocation( - QStandardPaths::AppDataLocation ) - + appDataFolders ) - .absoluteFilePath( "AdvancedSettings.log" ); + const auto appDataLocation + = std::string( "/" ) + application_strings::applicationOrganizationName + + "/" + application_strings::applicationName; + const auto logFilePath = QDir( QStandardPaths::writableLocation( + QStandardPaths::AppDataLocation ) + + appDataLocation.c_str() ) + .absoluteFilePath( "AdvancedSettings.log" ); conf.set( el::Level::Global, el::ConfigurationType::Filename, QDir::toNativeSeparators( logFilePath ).toStdString() );