diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 4bea38563008..11447573a48b 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -50,6 +50,9 @@ QStringList ABISYM( QgsApplication::mDefaultSvgPaths ); QString ABISYM( QgsApplication::mConfigPath ); bool ABISYM( QgsApplication::mRunningFromBuildDir ) = false; QString ABISYM( QgsApplication::mBuildSourcePath ); +#ifdef _MSC_VER +QString ABISYM( QgsApplication::mCfgIntDir ); +#endif QString ABISYM( QgsApplication::mBuildOutputPath ); QStringList ABISYM( QgsApplication::mGdalSkipList ); @@ -81,14 +84,23 @@ void QgsApplication::init( QString customConfigPath ) // check if QGIS is run from build directory (not the install directory) QDir appDir( applicationDirPath() ); - if ( appDir.exists( "source_path.txt" ) ) +#ifndef _MSC_VER +#define SOURCE_PATH "source_path.txt" +#else +#define SOURCE_PATH "../source_path.txt" +#endif + if ( appDir.exists( SOURCE_PATH ) ) { - QFile f( applicationDirPath() + "/source_path.txt" ); + QFile f( applicationDirPath() + "/" + SOURCE_PATH ); if ( f.open( QIODevice::ReadOnly ) ) { ABISYM( mRunningFromBuildDir ) = true; ABISYM( mBuildSourcePath ) = f.readAll(); -#if defined(Q_WS_MACX) || defined(Q_WS_WIN32) || defined(WIN32) +#if _MSC_VER + QStringList elems = applicationDirPath().split( "/", QString::SkipEmptyParts ); + ABISYM( mCfgIntDir ) = elems.last(); + ABISYM( mBuildOutputPath ) = applicationDirPath() + "/../.."; +#elif defined(Q_WS_MACX) ABISYM( mBuildOutputPath ) = applicationDirPath(); #else ABISYM( mBuildOutputPath ) = applicationDirPath() + "/.."; // on linux @@ -103,7 +115,11 @@ void QgsApplication::init( QString customConfigPath ) { // we run from source directory - not installed to destination (specified prefix) ABISYM( mPrefixPath ) = QString(); // set invalid path +#ifdef _MSC_VER + setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) + "/" + ABISYM( mCfgIntDir ) ); +#else setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) ); +#endif setPkgDataPath( ABISYM( mBuildSourcePath ) ); // directly source path - used for: doc, resources, svg ABISYM( mLibraryPath ) = ABISYM( mBuildOutputPath ) + "/" + QGIS_LIB_SUBDIR + "/"; ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) + "/" + QGIS_LIBEXEC_SUBDIR + "/"; diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index d8e7ca733387..38feef24bb52 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -222,6 +222,9 @@ class CORE_EXPORT QgsApplication: public QApplication /** Indicates whether running from build directory (not installed) @note added in 2.0 */ static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); } +#ifdef _MSC_VER + static QString cfgIntDir() { return ABISYM( mCfgIntDir ); } +#endif /** Returns path to the source directory. Valid only when running from build directory @note added in 2.0 */ static QString buildSourcePath() { return ABISYM( mBuildSourcePath ); } @@ -277,6 +280,10 @@ class CORE_EXPORT QgsApplication: public QApplication static bool ABISYM( mRunningFromBuildDir ); /** path to the source directory. valid only when running from build directory. */ static QString ABISYM( mBuildSourcePath ); +#ifdef _MSC_VER + /** configuration internal dir */ + static QString ABISYM( mCfgIntDir ); +#endif /** path to the output directory of the build. valid only when running from build directory */ static QString ABISYM( mBuildOutputPath ); /** List of gdal drivers to be skipped. Uses GDAL_SKIP to exclude them. diff --git a/src/core/qgsrasterdataprovider.h b/src/core/qgsrasterdataprovider.h index 6fddd04cdba0..4c6abe7636f0 100644 --- a/src/core/qgsrasterdataprovider.h +++ b/src/core/qgsrasterdataprovider.h @@ -379,7 +379,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider QString generateBandName( int theBandNumber ) { return tr( "Band" ) + QString( " %1" ) .arg( theBandNumber, 1 + ( int ) log10(( float ) bandCount() ), 10, QChar( '0' ) ); - }; + } /** * Get metadata in a format suitable for feeding directly