keyboard: Allow absolute paths for the xOrgConfFileName setting.

This should ensure it works on all distributions.
main
Kevin Kofler 10 years ago
parent 86d51b4a9c
commit 3e9de2a05a

@ -30,6 +30,7 @@
#include "utils/CalamaresUtilsSystem.h" #include "utils/CalamaresUtilsSystem.h"
#include <QDir> #include <QDir>
#include <QFileInfo>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <QSettings> #include <QSettings>
@ -245,19 +246,31 @@ SetKeyboardLayoutJob::exec()
QString vconsoleConfPath = destDir.absoluteFilePath( "etc/vconsole.conf" ); QString vconsoleConfPath = destDir.absoluteFilePath( "etc/vconsole.conf" );
// Get the path to the destination's /etc/X11/xorg.conf.d/00-keyboard.conf // Get the path to the destination's /etc/X11/xorg.conf.d/00-keyboard.conf
QString xorgConfDPath = destDir.absoluteFilePath( "etc/X11/xorg.conf.d" ); QString xorgConfDPath;
destDir.mkpath( xorgConfDPath ); QString keyboardConfPath;
QString keyboardConfPath = QDir( xorgConfDPath ) if ( QDir::isAbsolutePath( m_xOrgConfFileName ) )
{
keyboardConfPath = m_xOrgConfFileName;
while ( keyboardConfPath.startsWith( '/' ) )
keyboardConfPath.remove( 0, 1 );
keyboardConfPath = destDir.absoluteFilePath( keyboardConfPath );
xorgConfDPath = QFileInfo( keyboardConfPath ).path();
}
else
{
xorgConfDPath = destDir.absoluteFilePath( "etc/X11/xorg.conf.d" );
keyboardConfPath = QDir( xorgConfDPath )
.absoluteFilePath( m_xOrgConfFileName ); .absoluteFilePath( m_xOrgConfFileName );
}
destDir.mkpath( xorgConfDPath );
// Get the path to the destination's path to the converted key mappings // Get the path to the destination's path to the converted key mappings
QString convertedKeymapPath; QString convertedKeymapPath = m_convertedKeymapPath;
QString convertedKeymapPathSetting = m_convertedKeymapPath; if ( !convertedKeymapPath.isEmpty() )
if ( !convertedKeymapPathSetting.isEmpty() )
{ {
while ( convertedKeymapPathSetting.startsWith( '/' ) ) while ( convertedKeymapPath.startsWith( '/' ) )
convertedKeymapPathSetting.remove( 0, 1 ); convertedKeymapPath.remove( 0, 1 );
convertedKeymapPath = destDir.absoluteFilePath( convertedKeymapPathSetting ); convertedKeymapPath = destDir.absoluteFilePath( convertedKeymapPath );
} }
if ( !writeVConsoleData( vconsoleConfPath, convertedKeymapPath ) ) if ( !writeVConsoleData( vconsoleConfPath, convertedKeymapPath ) )

@ -1,7 +1,8 @@
--- ---
# The name of the file to write to /etc/X11/xorg.conf.d # The name of the file to write X11 keyboard settings to
# The default value is the name used by upstream systemd-localed. # The default value is the name used by upstream systemd-localed.
xOrgConfFileName: "00-keyboard.conf" # Relative paths are assumed to be relative to /etc/X11/xorg.conf.d
xOrgConfFileName: "/etc/X11/xorg.conf.d/00-keyboard.conf"
# The path to search for keymaps converted from X11 to kbd format # The path to search for keymaps converted from X11 to kbd format
# Leave this empty if the setting does not make sense on your distribution. # Leave this empty if the setting does not make sense on your distribution.
convertedKeymapPath: "/lib/kbd/keymaps/xkb" convertedKeymapPath: "/lib/kbd/keymaps/xkb"

Loading…
Cancel
Save