Properly load module config files with an explicit config path.
This commit is contained in:
parent
70691068cb
commit
f5b4de67c4
@ -117,9 +117,9 @@ Module::fromDescriptorFile( const QString& path )
|
|||||||
QFileInfo mfi( path );
|
QFileInfo mfi( path );
|
||||||
m->m_directory = mfi.absoluteDir().absolutePath();
|
m->m_directory = mfi.absoluteDir().absolutePath();
|
||||||
|
|
||||||
|
m->initFrom( doc );
|
||||||
m->loadConfigurationFile();
|
m->loadConfigurationFile();
|
||||||
|
|
||||||
m->initFrom( doc );
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
catch ( YAML::Exception& e )
|
catch ( YAML::Exception& e )
|
||||||
@ -138,17 +138,27 @@ void
|
|||||||
Module::loadConfigurationFile() //throws YAML::Exception
|
Module::loadConfigurationFile() //throws YAML::Exception
|
||||||
{
|
{
|
||||||
QStringList configFilesByPriority;
|
QStringList configFilesByPriority;
|
||||||
configFilesByPriority.append(
|
|
||||||
QString( "/etc/calamares/modules/%1.conf" ).arg( m_name ) );
|
|
||||||
configFilesByPriority.append(
|
|
||||||
CalamaresUtils::appDataDir().absoluteFilePath(
|
|
||||||
QString( "modules/%1.conf" ).arg( m_name ) ) );
|
|
||||||
|
|
||||||
if ( Settings::instance()->debugMode() )
|
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||||
{
|
{
|
||||||
configFilesByPriority.append(
|
configFilesByPriority.append(
|
||||||
QDir( QDir::currentPath() ).absoluteFilePath(
|
CalamaresUtils::appDataDir().absoluteFilePath(
|
||||||
QString( "src/modules/%1/%1.conf" ).arg( m_name ) ) );
|
QString( "modules/%1.conf" ).arg( m_name ) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( Settings::instance()->debugMode() )
|
||||||
|
{
|
||||||
|
configFilesByPriority.append(
|
||||||
|
QDir( QDir::currentPath() ).absoluteFilePath(
|
||||||
|
QString( "src/modules/%1/%1.conf" ).arg( m_name ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
configFilesByPriority.append(
|
||||||
|
QString( "/etc/calamares/modules/%1.conf" ).arg( m_name ) );
|
||||||
|
configFilesByPriority.append(
|
||||||
|
CalamaresUtils::appDataDir().absoluteFilePath(
|
||||||
|
QString( "modules/%1.conf" ).arg( m_name ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( const QString& path, configFilesByPriority )
|
foreach ( const QString& path, configFilesByPriority )
|
||||||
|
Loading…
Reference in New Issue
Block a user