Commit c9812024 authored by goro's avatar goro
Browse files

Fix file location, always return 0

parent beb0b183
......@@ -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;
}
......
......@@ -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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment