File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -798,6 +798,7 @@ int main( int argc, char *argv[] )
798
798
QCoreApplication::setAttribute ( Qt::AA_DisableWindowContextHelpButton, true );
799
799
#endif
800
800
801
+ QApplication *subapp = new QApplication (argc, argv);
801
802
// SetUp the QgsSettings Global Settings:
802
803
// - use the path specified with --globalsettingsfile path,
803
804
// - use the environment if not found
@@ -809,7 +810,8 @@ int main( int argc, char *argv[] )
809
810
810
811
if ( globalsettingsfile.isEmpty () )
811
812
{
812
- QString default_globalsettingsfile = QgsApplication::pkgDataPath () + " /qgis_global_settings.ini" ;
813
+ QString default_globalsettingsfile = QgsApplication::resolvePkgPath () + " /resources/qgis_global_settings.ini" ;
814
+ QgsDebugMsg ( " GLOABL SETTINGS FILE:" + default_globalsettingsfile );
813
815
if ( QFile::exists ( default_globalsettingsfile ) )
814
816
{
815
817
globalsettingsfile = default_globalsettingsfile;
@@ -849,6 +851,9 @@ int main( int argc, char *argv[] )
849
851
}
850
852
}
851
853
delete globalSettings;
854
+ delete subapp;
855
+
856
+ QgsDebugMsg ( " CONFIG LOCAL STORAGE:" + configLocalStorageLocation );
852
857
853
858
QString rootProfileFolder = QgsUserProfileManager::resolveProfilesFolder ( configLocalStorageLocation );
854
859
QgsUserProfileManager manager ( rootProfileFolder );
Original file line number Diff line number Diff line change @@ -577,6 +577,36 @@ void QgsApplication::setThemeName( const QString &themeName )
577
577
ABISYM ( mThemeName ) = themeName;
578
578
}
579
579
580
+ QString QgsApplication::resolvePkgPath ()
581
+ {
582
+ #if defined(ANDROID)
583
+ QString prefixPath ( getenv ( " QGIS_PREFIX_PATH" ) ? getenv ( " QGIS_PREFIX_PATH" ) : QDir::homePath () );
584
+ #else
585
+ QString prefixPath ( getenv ( " QGIS_PREFIX_PATH" ) ? getenv ( " QGIS_PREFIX_PATH" ) : applicationDirPath () );
586
+ #endif
587
+ QFile f;
588
+ // "/../../.." is for Mac bundled app in build directory
589
+ Q_FOREACH ( const QString &path, QStringList () << " " << " /.." << " /bin" << " /../../.." )
590
+ {
591
+ f.setFileName ( prefixPath + path + " /qgisbuildpath.txt" );
592
+ QgsDebugMsg (f.fileName ());
593
+ if ( f.exists () )
594
+ break ;
595
+ }
596
+
597
+ if ( f.exists () && f.open ( QIODevice::ReadOnly ) )
598
+ {
599
+ return f.readLine ().trimmed ();
600
+ QgsDebugMsg (" Running from build dir!" );
601
+ return buildSourcePath;
602
+ }
603
+ else
604
+ {
605
+ return prefixPath + ' /' + QStringLiteral ( QGIS_DATA_SUBDIR );
606
+ }
607
+
608
+ }
609
+
580
610
QString QgsApplication::themeName ()
581
611
{
582
612
return ABISYM ( mThemeName );
Original file line number Diff line number Diff line change @@ -184,6 +184,8 @@ class CORE_EXPORT QgsApplication : public QApplication
184
184
*/
185
185
static void setThemeName ( const QString &themeName );
186
186
187
+ static QString resolvePkgPath ( );
188
+
187
189
/* *
188
190
* Set the active theme to the specified theme.
189
191
* The theme name should be a single word e.g. 'default','classic'.
You can’t perform that action at this time.
0 commit comments