Convert logfile to use new paths functions
This commit is contained in:
@@ -51,4 +51,17 @@ optional<string> binaryDirectoryFindDirectory( const string directoryName )
|
||||
return path.toStdString();
|
||||
}
|
||||
|
||||
optional<string> settingsDirectory()
|
||||
{
|
||||
const auto path
|
||||
= QStandardPaths::writableLocation( QStandardPaths::AppDataLocation );
|
||||
if ( path == "" )
|
||||
{
|
||||
LOG( ERROR ) << "Could not find settings directory.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return path.toStdString();
|
||||
}
|
||||
|
||||
} // namespace paths
|
||||
|
||||
@@ -12,6 +12,5 @@ optional<string> binaryDirectoryFindFile( string fileName );
|
||||
optional<string> binaryDirectoryFindDirectory( string directoryName );
|
||||
|
||||
optional<string> settingsDirectory();
|
||||
optional<string> settingsDirectoryFindFile( string fileName );
|
||||
|
||||
} // namespace paths
|
||||
|
||||
+4
-4
@@ -275,10 +275,10 @@ void setUpLogging()
|
||||
const auto appDataLocation
|
||||
= std::string( "/" ) + application_strings::applicationOrganizationName
|
||||
+ "/";
|
||||
const auto logFilePath = QDir( QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation )
|
||||
+ appDataLocation.c_str() )
|
||||
.absoluteFilePath( logFileName );
|
||||
const auto logFilePath
|
||||
= QDir( QString::fromStdString( *paths::settingsDirectory() )
|
||||
+ appDataLocation.c_str() )
|
||||
.absoluteFilePath( logFileName );
|
||||
conf.set( el::Level::Global,
|
||||
el::ConfigurationType::Filename,
|
||||
QDir::toNativeSeparators( logFilePath ).toStdString() );
|
||||
|
||||
Reference in New Issue
Block a user