summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-11-22 14:14:24 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-22 17:36:45 +0100
commitbbb06afe37e6a58d13f51d355d2a36b4d4d03d39 (patch)
tree1e5ec956f0f2afae3232fb1fe1e8b32ffbb81863 /src/tools
parentcd3e1f5dd257fbe1d1b86d4f72eea01293d31047 (diff)
do not lower-case input file names
The idc tool modified the case of its DLL or EXE input, causing it to be all lowercase. Task-number: QTBUG-2870 Change-Id: Ic3c028a2696786fc5b11a4018bd3fc28e362935b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/idc/main.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp
index 902b858..98e2b52 100644
--- a/src/tools/idc/main.cpp
+++ b/src/tools/idc/main.cpp
@@ -54,6 +54,20 @@ static QString quotePath(const QString &s)
return s;
}
+static bool hasFileExtension(const QString &filePath, const QString &extension)
+{
+ return filePath.endsWith(extension, Qt::CaseInsensitive);
+}
+
+static bool hasExeExtension(const QString &filePath)
+{
+ return hasFileExtension(filePath, QStringLiteral(".exe"));
+}
+
+static bool hasDllExtension(const QString &filePath)
+{
+ return hasFileExtension(filePath, QStringLiteral(".dll"));
+}
static bool runWithQtInEnvironment(const QString &cmd)
{
@@ -113,7 +127,7 @@ static bool attachTypeLibrary(const QString &applicationName, int resource, cons
static bool registerServer(const QString &input)
{
bool ok = false;
- if (input.endsWith(QLatin1String(".exe"))) {
+ if (hasExeExtension(input)) {
ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -regserver"));
} else {
HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16());
@@ -135,7 +149,7 @@ static bool registerServer(const QString &input)
static bool unregisterServer(const QString &input)
{
bool ok = false;
- if (input.endsWith(QLatin1String(".exe"))) {
+ if (hasExeExtension(input)) {
ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -unregserver"));
} else {
HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16());
@@ -158,7 +172,7 @@ static HRESULT dumpIdl(const QString &input, const QString &idlfile, const QStri
{
HRESULT res = E_FAIL;
- if (input.endsWith(QLatin1String(".exe"))) {
+ if (hasExeExtension(input)) {
if (runWithQtInEnvironment(quotePath(input) + QLatin1String(" -dumpidl ") + idlfile + QLatin1String(" -version ") + version))
res = S_OK;
} else {
@@ -212,7 +226,7 @@ int runIdc(int argc, char **argv)
break;
}
idlfile = QLatin1String(argv[i]);
- idlfile = idlfile.trimmed().toLower();
+ idlfile = idlfile.trimmed();
} else if (p == QLatin1String("/version") || p == QLatin1String("-version")) {
++i;
if (i > argc)
@@ -226,7 +240,7 @@ int runIdc(int argc, char **argv)
break;
}
tlbfile = QLatin1String(argv[i]);
- tlbfile = tlbfile.trimmed().toLower();
+ tlbfile = tlbfile.trimmed();
} else if (p == QLatin1String("/v") || p == QLatin1String("-v")) {
fprintf(stdout, "Qt Interface Definition Compiler version 1.0\n");
return 0;
@@ -249,7 +263,7 @@ int runIdc(int argc, char **argv)
break;
} else {
input = QLatin1String(argv[i]);
- input = input.trimmed().toLower();
+ input = input.trimmed();
}
i++;
}
@@ -262,11 +276,11 @@ int runIdc(int argc, char **argv)
fprintf(stderr, "No input file specified!\n");
return 1;
}
- if (input.endsWith(QLatin1String(".exe")) && tlbfile.isEmpty() && idlfile.isEmpty()) {
+ if (hasExeExtension(input) && tlbfile.isEmpty() && idlfile.isEmpty()) {
fprintf(stderr, "No type output file specified!\n");
return 2;
}
- if (input.endsWith(QLatin1String(".dll")) && idlfile.isEmpty() && tlbfile.isEmpty()) {
+ if (hasDllExtension(input) && idlfile.isEmpty() && tlbfile.isEmpty()) {
fprintf(stderr, "No interface definition file and no type library file specified!\n");
return 3;
}