diff --git a/src/calamares/Settings.cpp b/src/calamares/Settings.cpp index 0df7620df..7fd2bb008 100644 --- a/src/calamares/Settings.cpp +++ b/src/calamares/Settings.cpp @@ -68,7 +68,24 @@ Settings::Settings( QObject* parent ) for ( int i = 0; i < rawPaths.length(); ++i ) { if ( rawPaths[ i ] == "local" ) - m_modulesSearchPaths.append( CalamaresUtils::appDataDir().absolutePath() + QDir::separator() + "modules" ); + { + // If we're running in debug mode, we assume we might also be + // running from the build dir, so we add a maximum priority + // module search path in the build dir. + if ( APP->isDebug() ) + { + QString buildDirModules = QDir::current().absolutePath() + + QDir::separator() + "src" + + QDir::separator() + "modules"; + if ( QDir( buildDirModules ).exists() ) + m_modulesSearchPaths.append( buildDirModules ); + } + + // Install path is set in CalamaresAddPlugin.cmake + m_modulesSearchPaths.append( CalamaresUtils::systemLibDir().absolutePath() + + QDir::separator() + "calamares" + + QDir::separator() + "modules" ); + } else { QDir path( rawPaths[ i ] ); diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 6af3edadf..dad247f66 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -5,7 +5,7 @@ add_definitions( -DQT_SHARED ) add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS ) add_definitions( -DDLLEXPORT_PRO ) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../calamares/Config.h.in +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../calamares/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h ) diff --git a/src/calamares/Config.h.in b/src/libcalamares/Config.h.in similarity index 85% rename from src/calamares/Config.h.in rename to src/libcalamares/Config.h.in index 27d98fea8..82fdb4b20 100644 --- a/src/calamares/Config.h.in +++ b/src/libcalamares/Config.h.in @@ -4,6 +4,7 @@ #define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" #define CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}" #define CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" +#define CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}" #define CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/calamares" //cmakedefines for CMake variables (e.g. for optdepends) go here diff --git a/src/libcalamares/utils/CalamaresUtils.cpp b/src/libcalamares/utils/CalamaresUtils.cpp index 761f3134b..945f1ddd1 100644 --- a/src/libcalamares/utils/CalamaresUtils.cpp +++ b/src/libcalamares/utils/CalamaresUtils.cpp @@ -45,6 +45,17 @@ appDataDir() } +QDir +systemLibDir() +{ + QDir path( CMAKE_INSTALL_FULL_LIBDIR ); + if ( !path.exists() || !path.isReadable() ) + path.mkpath( path.absolutePath() ); + + return path; +} + + QDir appLogDir() { diff --git a/src/libcalamares/utils/CalamaresUtils.h b/src/libcalamares/utils/CalamaresUtils.h index e8041a1a1..fdb0d053c 100644 --- a/src/libcalamares/utils/CalamaresUtils.h +++ b/src/libcalamares/utils/CalamaresUtils.h @@ -33,6 +33,7 @@ namespace CalamaresUtils { DLLEXPORT QDir appDataDir(); DLLEXPORT QDir appLogDir(); + DLLEXPORT QDir systemLibDir(); DLLEXPORT void installTranslator( QObject* parent ); }