Skip to content

Commit a4e22ee

Browse files
authored
Merge pull request #8621 from signedav/backport-fix-ts-file
.qgs-translation fix: do not create QgsProject before QgsApplication
2 parents 7f5afe6 + a4adbe9 commit a4e22ee

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/app/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ APP_EXPORT
432432
#endif
433433
int main( int argc, char *argv[] )
434434
{
435+
//log messages written before creating QgsApplication
436+
QStringList preApplicationLogMessages;
437+
435438
#ifdef Q_OS_MACX
436439
// Increase file resource limits (i.e., number of allowed open files)
437440
// (from code provided by Larry Biehl, Purdue University, USA, from 'MultiSpec' project)
@@ -868,11 +871,11 @@ int main( int argc, char *argv[] )
868871
{
869872
if ( !QgsSettings::setGlobalSettingsPath( globalsettingsfile ) )
870873
{
871-
QgsMessageLog::logMessage( QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
874+
preApplicationLogMessages << QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
872875
}
873876
else
874877
{
875-
QgsMessageLog::logMessage( QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
878+
preApplicationLogMessages << QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
876879
}
877880
}
878881

@@ -972,6 +975,10 @@ int main( int argc, char *argv[] )
972975

973976
QgsApplication myApp( argc, argv, myUseGuiFlag );
974977

978+
//write the log messages written before creating QgsApplication
979+
for ( const QString &preApplicationLogMessage : qgis::as_const( preApplicationLogMessages ) )
980+
QgsMessageLog::logMessage( preApplicationLogMessage );
981+
975982
// Settings migration is only supported on the default profile for now.
976983
if ( profileName == QLatin1String( "default" ) )
977984
{

0 commit comments

Comments
 (0)