summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/fileutils.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-07-03 11:36:37 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-07-04 14:41:21 +0200
commit7f4fadd08d88262f357671cb8c039253c6e65326 (patch)
tree16b5128e609771d78fd1ab7673b0bbd72904afae /src/libs/installer/fileutils.cpp
parentd847723173a5cd2bb2eb27ff0eb45ae323c8070a (diff)
Workaround for QFileInfo::isBundle().
For some reason the former code did not work anyore as expected, the issue seems to be in QFileInfo::isBundle or how we used it. To not depend on a possible fix in Qt, we now always resolve the path before we ask QFileInfo if it is a bundle. Fixes also the behavior change introduced in cead4555. On OSX, we get the .dat file passed that's inside the bundle, still we need to read the data from a .dat file that's located beside the app bundle... Change-Id: Idaa7adc6fbad6bd8e9ce90c383b34ea51fe40e8f Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/libs/installer/fileutils.cpp')
-rw-r--r--src/libs/installer/fileutils.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp
index 2ec690f6d..4708e5602 100644
--- a/src/libs/installer/fileutils.cpp
+++ b/src/libs/installer/fileutils.cpp
@@ -570,3 +570,22 @@ quint64 QInstaller::fileSize(const QFileInfo &info)
return symlinkSizeWin(info.absoluteFilePath());
#endif
}
+
+bool QInstaller::isInBundle(const QString &path, QString *bundlePath)
+{
+#ifdef Q_OS_OSX
+ QFileInfo fi = QFileInfo(path).absoluteFilePath();
+ while (!fi.isRoot()) {
+ if (fi.isBundle()) {
+ if (bundlePath)
+ *bundlePath = fi.absoluteFilePath();
+ return true;
+ }
+ fi.setFile(fi.path());
+ }
+#else
+ Q_UNUSED(path)
+ Q_UNUSED(bundlePath)
+#endif
+ return false;
+}