Replace dedicated functions with single binary function

There are only 1 or 2 calls to specific directories in the codebase,
hence this is unnecessary and just leads to bloat.
This commit is contained in:
Vasily
2019-03-19 16:10:35 +01:00
committed by username223
parent d6660049e9
commit 62dcea6943
3 changed files with 24 additions and 37 deletions
+13 -4
View File
@@ -48,11 +48,20 @@ int main( int argc, char* argv[] )
commandLineArgs.forceNoSound,
qmlEngine );
QString path = QStandardPaths::locate(
QStandardPaths::AppDataLocation,
QStringLiteral( "res/qml/common/mainwidget.qml" ) );
const auto path
= paths::binaryDirectoryFindFile( "res/qml/common/mainwidget.qml" );
QQmlComponent component( &qmlEngine, QUrl::fromLocalFile( path ) );
if ( !path.has_value() )
{
LOG( ERROR ) << "Unable to find file '" << *path << "'.";
throw std::runtime_error(
"Unable to find critical file. See log for more information." );
}
const auto url
= QUrl::fromLocalFile( QString::fromStdString( ( *path ) ) );
QQmlComponent component( &qmlEngine, url );
auto errors = component.errors();
for ( auto& e : errors )
{