Browse Source

Fix string patching

master
probonopd 8 years ago
parent
commit
60725dec9a
  1. 15
      shared/shared.cpp

15
shared/shared.cpp

@ -618,7 +618,7 @@ bool patchQtCore(const QString &path, const QString &variable, const QString &va
int startPos = content.indexOf(searchStringQByteArray); int startPos = content.indexOf(searchStringQByteArray);
if (startPos != -1) { if (startPos != -1) {
LogNormal() << QString::fromLatin1( LogNormal() << QString::fromLatin1(
"Patching %2 in %1 to '%3'").arg(QDir::toNativeSeparators(path), variable, value); "Patching value of %2 in %1 to '%3'").arg(QDir::toNativeSeparators(path), variable, value);
} }
startPos += searchStringQByteArray.length(); startPos += searchStringQByteArray.length();
int endPos = content.indexOf(char(0), startPos); int endPos = content.indexOf(char(0), startPos);
@ -671,8 +671,9 @@ bool patchString(const QString &path, const QString &searchString, const QString
int startPos = content.indexOf(searchStringQByteArray); int startPos = content.indexOf(searchStringQByteArray);
if (startPos != -1) { if (startPos != -1) {
LogNormal() << "startPos:" << startPos;
LogNormal() << QString::fromLatin1( LogNormal() << QString::fromLatin1(
"Patching %2 in %1 to '%3'").arg(QDir::toNativeSeparators(path), searchString, replacementString); "Patching string %2 in %1 to '%3'").arg(QDir::toNativeSeparators(path), searchString, replacementString);
} }
int endPos = content.indexOf(char(0), startPos); int endPos = content.indexOf(char(0), startPos);
if (endPos == -1) { if (endPos == -1) {
@ -681,10 +682,10 @@ bool patchString(const QString &path, const QString &searchString, const QString
return false; return false;
} }
QByteArray replacement = QByteArray(endPos - startPos, char(0)); QByteArray replacement = QByteArray(searchString.length(), char(0));
QByteArray replacementBegin = replacementString.toLatin1().data(); QByteArray replacementBegin = replacementString.toLatin1().data();
replacement.prepend(replacementBegin); replacement.prepend(replacementBegin);
replacement.truncate(endPos - startPos); replacement.truncate(searchString.length());
content.replace(startPos, endPos - startPos, replacement); content.replace(startPos, endPos - startPos, replacement);
@ -871,7 +872,7 @@ DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,
runStrip(deployedBinaryPath); runStrip(deployedBinaryPath);
if (!library.rpathUsed.length()) { if (!library.rpathUsed.length()) {
changeIdentification(library.deployedInstallName, deployedBinaryPath); changeIdentification(library.deployedInstallName, QFileInfo(deployedBinaryPath).canonicalFilePath());
} }
// Check for library dependencies // Check for library dependencies
@ -949,9 +950,9 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a
} }
if(fhsLikeMode == false){ if(fhsLikeMode == false){
changeIdentification("$ORIGIN/lib/" + bundleLibraryDirectory, applicationBundle.binaryPath); changeIdentification("$ORIGIN/lib/" + bundleLibraryDirectory, QFileInfo(applicationBundle.binaryPath).canonicalFilePath());
} else { } else {
changeIdentification("$ORIGIN/../lib/" + bundleLibraryDirectory, applicationBundle.binaryPath); changeIdentification("$ORIGIN/../lib/" + bundleLibraryDirectory, QFileInfo(applicationBundle.binaryPath).canonicalFilePath());
} }
applicationBundle.libraryPaths = findAppLibraries(appDirPath); applicationBundle.libraryPaths = findAppLibraries(appDirPath);
LogDebug() << "applicationBundle.libraryPaths:" << applicationBundle.libraryPaths; LogDebug() << "applicationBundle.libraryPaths:" << applicationBundle.libraryPaths;

Loading…
Cancel
Save