Skip to content
Permalink
Browse files

Lets try fix this

  • Loading branch information
NathanW2 committed Feb 12, 2018
1 parent 2cbcf74 commit 3b6d37fee0f8491b1f6e32747f4dd6895591d25c
Showing with 38 additions and 1 deletion.
  1. +6 −1 src/app/main.cpp
  2. +30 −0 src/core/qgsapplication.cpp
  3. +2 −0 src/core/qgsapplication.h
@@ -798,6 +798,7 @@ int main( int argc, char *argv[] )
QCoreApplication::setAttribute( Qt::AA_DisableWindowContextHelpButton, true );
#endif

QApplication *subapp = new QApplication(argc, argv);
// SetUp the QgsSettings Global Settings:
// - use the path specified with --globalsettingsfile path,
// - use the environment if not found
@@ -809,7 +810,8 @@ int main( int argc, char *argv[] )

if ( globalsettingsfile.isEmpty() )
{
QString default_globalsettingsfile = QgsApplication::pkgDataPath() + "/qgis_global_settings.ini";
QString default_globalsettingsfile = QgsApplication::resolvePkgPath() + "/resources/qgis_global_settings.ini";
QgsDebugMsg( "GLOABL SETTINGS FILE:" + default_globalsettingsfile );
if ( QFile::exists( default_globalsettingsfile ) )
{
globalsettingsfile = default_globalsettingsfile;
@@ -849,6 +851,9 @@ int main( int argc, char *argv[] )
}
}
delete globalSettings;
delete subapp;

QgsDebugMsg( "CONFIG LOCAL STORAGE:" + configLocalStorageLocation );

QString rootProfileFolder = QgsUserProfileManager::resolveProfilesFolder( configLocalStorageLocation );
QgsUserProfileManager manager( rootProfileFolder );
@@ -577,6 +577,36 @@ void QgsApplication::setThemeName( const QString &themeName )
ABISYM( mThemeName ) = themeName;
}

QString QgsApplication::resolvePkgPath()
{
#if defined(ANDROID)
QString prefixPath( getenv( "QGIS_PREFIX_PATH" ) ? getenv( "QGIS_PREFIX_PATH" ) : QDir::homePath() );
#else
QString prefixPath( getenv( "QGIS_PREFIX_PATH" ) ? getenv( "QGIS_PREFIX_PATH" ) : applicationDirPath() );
#endif
QFile f;
// "/../../.." is for Mac bundled app in build directory
Q_FOREACH ( const QString &path, QStringList() << "" << "/.." << "/bin" << "/../../.." )
{
f.setFileName( prefixPath + path + "/qgisbuildpath.txt" );
QgsDebugMsg(f.fileName());
if ( f.exists() )
break;
}

if ( f.exists() && f.open( QIODevice::ReadOnly ) )
{
return f.readLine().trimmed();
QgsDebugMsg("Running from build dir!");
return buildSourcePath;
}
else
{
return prefixPath + '/' + QStringLiteral( QGIS_DATA_SUBDIR );
}

}

QString QgsApplication::themeName()
{
return ABISYM( mThemeName );
@@ -184,6 +184,8 @@ class CORE_EXPORT QgsApplication : public QApplication
*/
static void setThemeName( const QString &themeName );

static QString resolvePkgPath( );

/**
* Set the active theme to the specified theme.
* The theme name should be a single word e.g. 'default','classic'.

0 comments on commit 3b6d37f

Please sign in to comment.
You can’t perform that action at this time.