Check for any existing file in XCOMPOSEFILE.

Before this change, it was checked if the path ends with "Compose", which was
an invalid assumption as the file can have any name (see [1])

This replaces the check with a check for any existing file (which wasn't
checked before).

[1] http://www.x.org/releases/X11R7.7/doc/man/man5/Compose.5.xhtml

Done-with: Florian Bruhin <git@the-compiler.org>
Task-number: QTBUG-41557
Change-Id: If4fb58d4c1ed695f2d611236abfe97964b548678
Reviewed-by: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
This commit is contained in:
Giuseppe D'Angelo 2015-12-09 12:36:10 +01:00
parent b64c11f464
commit b4d3f9bd82

View File

@ -263,11 +263,11 @@ QString TableGenerator::findComposeFile()
{
// check if XCOMPOSEFILE points to a Compose file
if (qEnvironmentVariableIsSet("XCOMPOSEFILE")) {
QString path(qgetenv("XCOMPOSEFILE"));
if (path.endsWith(QLatin1String("Compose")))
const QString path = QFile::decodeName(qgetenv("XCOMPOSEFILE"));
if (QFile::exists(path))
return path;
else
qWarning("Qt Warning: XCOMPOSEFILE doesn't point to a valid Compose file");
qWarning("$XCOMPOSEFILE doesn't point to an existing file");
}
// check if users home directory has a file named .XCompose