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();
|
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
|
} // namespace paths
|
||||||
|
|||||||
@@ -12,6 +12,5 @@ optional<string> binaryDirectoryFindFile( string fileName );
|
|||||||
optional<string> binaryDirectoryFindDirectory( string directoryName );
|
optional<string> binaryDirectoryFindDirectory( string directoryName );
|
||||||
|
|
||||||
optional<string> settingsDirectory();
|
optional<string> settingsDirectory();
|
||||||
optional<string> settingsDirectoryFindFile( string fileName );
|
|
||||||
|
|
||||||
} // namespace paths
|
} // namespace paths
|
||||||
|
|||||||
+4
-4
@@ -275,10 +275,10 @@ void setUpLogging()
|
|||||||
const auto appDataLocation
|
const auto appDataLocation
|
||||||
= std::string( "/" ) + application_strings::applicationOrganizationName
|
= std::string( "/" ) + application_strings::applicationOrganizationName
|
||||||
+ "/";
|
+ "/";
|
||||||
const auto logFilePath = QDir( QStandardPaths::writableLocation(
|
const auto logFilePath
|
||||||
QStandardPaths::AppDataLocation )
|
= QDir( QString::fromStdString( *paths::settingsDirectory() )
|
||||||
+ appDataLocation.c_str() )
|
+ appDataLocation.c_str() )
|
||||||
.absoluteFilePath( logFileName );
|
.absoluteFilePath( logFileName );
|
||||||
conf.set( el::Level::Global,
|
conf.set( el::Level::Global,
|
||||||
el::ConfigurationType::Filename,
|
el::ConfigurationType::Filename,
|
||||||
QDir::toNativeSeparators( logFilePath ).toStdString() );
|
QDir::toNativeSeparators( logFilePath ).toStdString() );
|
||||||
|
|||||||
Reference in New Issue
Block a user