aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/qtlibspatcher
diff options
context:
space:
mode:
authorgoro <[email protected]>2009-01-29 19:26:13 +0100
committergoro <[email protected]>2009-01-29 19:26:51 +0100
commitc981202454a1383872a13414a1e107b20e4ae7c0 (patch)
treeb9cef73b65fe1fe4c0cdee2554e0e822f8c4f009 /src/tools/qtlibspatcher
parentbeb0b18320ed7b1eadd8c30f5a768fa6fa93aa0b (diff)
Fix file location, always return 0
Diffstat (limited to 'src/tools/qtlibspatcher')
-rw-r--r--src/tools/qtlibspatcher/binpatch.cpp2
-rw-r--r--src/tools/qtlibspatcher/qtlibspatchermain.cpp128
2 files changed, 66 insertions, 64 deletions
diff --git a/src/tools/qtlibspatcher/binpatch.cpp b/src/tools/qtlibspatcher/binpatch.cpp
index e2fd4cc2f2e..7e1dcfbbdd8 100644
--- a/src/tools/qtlibspatcher/binpatch.cpp
+++ b/src/tools/qtlibspatcher/binpatch.cpp
@@ -181,7 +181,7 @@ bool BinPatch::patch(const char *oldstr, const char *newstr)
if (!(input = fopen(fileName, "r+b")))
{
- fprintf(stderr, "Cannot open file %s!\n", fileName);
+ fprintf(stderr, "Warning: Could not open file %s\n", fileName);
return false;
}
diff --git a/src/tools/qtlibspatcher/qtlibspatchermain.cpp b/src/tools/qtlibspatcher/qtlibspatchermain.cpp
index 4fba6a025c1..d5c976c9e19 100644
--- a/src/tools/qtlibspatcher/qtlibspatchermain.cpp
+++ b/src/tools/qtlibspatcher/qtlibspatchermain.cpp
@@ -631,67 +631,67 @@ const char * const textFileFileNames[] =
{
#ifndef Q_OS_WIN
// *.la
- "lib/libQtCore.la",
- "lib/libQt3Support.la",
- "lib/libQtCLucene.la",
- "lib/libQtDBus.la",
- "lib/libQtGui.la",
- "lib/libQtHelp.la",
- "lib/libQtNetwork.la",
- "lib/libQtOpenGL.la",
- "lib/libQtScript.la",
- "lib/libQtSql.la",
- "lib/libQtSvg.la",
- "lib/libQtTest.la",
- "lib/libQtWebKit.la",
- "lib/libQtXml.la",
- "lib/libQtXmlPatterns.la",
+ "/lib/libQtCore.la",
+ "/lib/libQt3Support.la",
+ "/lib/libQtCLucene.la",
+ "/lib/libQtDBus.la",
+ "/lib/libQtGui.la",
+ "/lib/libQtHelp.la",
+ "/lib/libQtNetwork.la",
+ "/lib/libQtOpenGL.la",
+ "/lib/libQtScript.la",
+ "/lib/libQtSql.la",
+ "/lib/libQtSvg.la",
+ "/lib/libQtTest.la",
+ "/lib/libQtWebKit.la",
+ "/lib/libQtXml.la",
+ "/lib/libQtXmlPatterns.la",
// *.prl
- "demos/shared/libdemo_shared.prl",
- "lib/libQt3Support.prl",
- "lib/libQtAssistantClient.prl",
- "lib/libQtCLucene.prl",
- "lib/libQtCore.prl",
- "lib/libQtDBus.prl",
- "lib/libQtDesignerComponents.prl",
- "lib/libQtDesigner.prl",
- "lib/libQtGui.prl",
- "lib/libQtHelp.prl",
- "lib/libQtNetwork.prl",
- "lib/libQtOpenGL.prl",
- "lib/libQtScript.prl",
- "lib/libQtSql.prl",
- "lib/libQtSvg.prl",
- "lib/libQtTest.prl",
- "lib/libQtUiTools.prl",
- "lib/libQtWebKit.prl",
- "lib/libQtXmlPatterns.prl",
- "lib/libQtXml.prl",
+ "/demos/shared/libdemo_shared.prl",
+ "/lib/libQt3Support.prl",
+ "/lib/libQtAssistantClient.prl",
+ "/lib/libQtCLucene.prl",
+ "/lib/libQtCore.prl",
+ "/lib/libQtDBus.prl",
+ "/lib/libQtDesignerComponents.prl",
+ "/lib/libQtDesigner.prl",
+ "/lib/libQtGui.prl",
+ "/lib/libQtHelp.prl",
+ "/lib/libQtNetwork.prl",
+ "/lib/libQtOpenGL.prl",
+ "/lib/libQtScript.prl",
+ "/lib/libQtSql.prl",
+ "/lib/libQtSvg.prl",
+ "/lib/libQtTest.prl",
+ "/lib/libQtUiTools.prl",
+ "/lib/libQtWebKit.prl",
+ "/lib/libQtXmlPatterns.prl",
+ "/lib/libQtXml.prl",
// *.pc
- "lib/pkgconfig/Qt3Support.pc",
- "lib/pkgconfig/QtAssistantClient.pc",
- "lib/pkgconfig/QtCLucene.pc",
- "lib/pkgconfig/QtCore.pc",
- "lib/pkgconfig/QtDBus.pc",
- "lib/pkgconfig/QtDesignerComponents.pc",
- "lib/pkgconfig/QtDesigner.pc",
- "lib/pkgconfig/QtGui.pc",
- "lib/pkgconfig/QtHelp.pc",
- "lib/pkgconfig/QtNetwork.pc",
- "lib/pkgconfig/QtOpenGL.pc",
- "lib/pkgconfig/QtScript.pc",
- "lib/pkgconfig/QtSql.pc",
- "lib/pkgconfig/QtSvg.pc",
- "lib/pkgconfig/QtTest.pc",
- "lib/pkgconfig/QtUiTools.pc",
- "lib/pkgconfig/QtWebKit.pc",
- "lib/pkgconfig/QtXmlPatterns.pc",
- "lib/pkgconfig/QtXml.pc",
+ "/lib/pkgconfig/Qt3Support.pc",
+ "/lib/pkgconfig/QtAssistantClient.pc",
+ "/lib/pkgconfig/QtCLucene.pc",
+ "/lib/pkgconfig/QtCore.pc",
+ "/lib/pkgconfig/QtDBus.pc",
+ "/lib/pkgconfig/QtDesignerComponents.pc",
+ "/lib/pkgconfig/QtDesigner.pc",
+ "/lib/pkgconfig/QtGui.pc",
+ "/lib/pkgconfig/QtHelp.pc",
+ "/lib/pkgconfig/QtNetwork.pc",
+ "/lib/pkgconfig/QtOpenGL.pc",
+ "/lib/pkgconfig/QtScript.pc",
+ "/lib/pkgconfig/QtSql.pc",
+ "/lib/pkgconfig/QtSvg.pc",
+ "/lib/pkgconfig/QtTest.pc",
+ "/lib/pkgconfig/QtUiTools.pc",
+ "/lib/pkgconfig/QtWebKit.pc",
+ "/lib/pkgconfig/QtXmlPatterns.pc",
+ "/lib/pkgconfig/QtXml.pc",
// misc
- "mkspecs/qconfig.pri"
+ "/mkspecs/qconfig.pri"
#endif
};
@@ -699,11 +699,11 @@ void replaceInTextFile(const char * fileName,
const char * oldText, const char * newText,
const char * oldText2 = NULL, const char * newText2 = NULL)
{
- const QString errorMessage = QString("Could not patch file ") + fileName;
+ const QString errorMessage = QString("Warning: Could not patch file ") + fileName;
QFile f(fileName);
if (!f.open(QIODevice::ReadOnly)) {
- std::cout << qPrintable(errorMessage) << std::endl;
+ std::cerr << qPrintable(errorMessage) << std::endl;
return;
}
QTextStream in(&f);
@@ -716,7 +716,7 @@ void replaceInTextFile(const char * fileName,
}
if (!f.open(QIODevice::WriteOnly)) {
- std::cout << qPrintable(errorMessage) << std::endl;
+ std::cerr << qPrintable(errorMessage) << std::endl;
return;
}
QTextStream out(&f);
@@ -726,15 +726,17 @@ void replaceInTextFile(const char * fileName,
void patchTextFiles(const char *newInstallBase)
{
+ const char * const baseQtPath = newInstallBase;
const char * const newSourceBase = newInstallBase;
const int fileCount = sizeof(textFileFileNames) / sizeof(const char *);
for (int i = 0; i < fileCount; i++) {
- logFileName(textFileFileNames[i]);
+ char * const fileName = allocFileNameCopyAppend(baseQtPath, textFileFileNames[i]);
+ logFileName(fileName);
logDiff(oldSourceBase, newSourceBase);
#ifndef Q_OS_WIN
logDiff(oldInstallBase, newInstallBase);
#endif
- replaceInTextFile(textFileFileNames[i],
+ replaceInTextFile(fileName,
#ifndef Q_OS_WIN
oldSourceBase, newSourceBase,
#endif
@@ -770,8 +772,8 @@ int main(int argc, char *args[])
break;
patchTextFiles(baseQtPath);
- const bool successOne = patchBinariesWithQtPathes(baseQtPath);
- const bool successTwo = patchDebugLibrariesWithQtPath(baseQtPath);
+ patchBinariesWithQtPathes(baseQtPath);
+ patchDebugLibrariesWithQtPath(baseQtPath);
delete[] baseQtPath;
- return (successOne && successTwo) ? 0 : 1;
+ return 0;
}