diff options
| author | Tim Jenssen <tim.jenssen@qt.io> | 2023-03-03 18:13:30 +0100 |
|---|---|---|
| committer | Tim Jenssen <tim.jenssen@qt.io> | 2023-03-06 04:46:03 +0000 |
| commit | b619f24396ab5d446f39d2d53904829254c19a80 (patch) | |
| tree | 0451ca1653cf62cef601f3322aea4006e8375ea0 /src/tools/qml2puppet | |
| parent | 6445db8ca2c687190588d4d6be76ee559f248cec (diff) | |
| download | qt-creator-b619f24396ab5d446f39d2d53904829254c19a80.tar.gz | |
crashpad: change chrashpad dumps location to user directory on macOS
This is necessary to not pollute the signed and notarized .app
bundle.
Task-number: QDS-9113
Change-Id: I74e0bced5679faac94b27d2a31ea10a7949fb21f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/tools/qml2puppet')
| -rw-r--r-- | src/tools/qml2puppet/qml2puppet/configcrashpad.h | 16 | ||||
| -rw-r--r-- | src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp | 22 |
2 files changed, 33 insertions, 5 deletions
diff --git a/src/tools/qml2puppet/qml2puppet/configcrashpad.h b/src/tools/qml2puppet/qml2puppet/configcrashpad.h index 7b663b8449..d6ecc8af4f 100644 --- a/src/tools/qml2puppet/qml2puppet/configcrashpad.h +++ b/src/tools/qml2puppet/qml2puppet/configcrashpad.h @@ -17,13 +17,21 @@ namespace { #if defined(ENABLE_CRASHPAD) && defined(Q_OS_WIN) - bool startCrashpad() + bool startCrashpad(const QString& libexecPath, const QString& crashReportsPath) { using namespace crashpad; // Cache directory that will store crashpad information and minidumps - base::FilePath database(L"crashpad_reports"); - base::FilePath handler(L"crashpad_handler.exe"); + QString databasePath = QDir::cleanPath(crashReportsPath); + QString handlerPath = QDir::cleanPath(libexecPath + "/crashpad_handler"); + #ifdef Q_OS_WIN + handlerPath += ".exe"; + base::FilePath database(databasePath.toStdWString()); + base::FilePath handler(handlerPath.toStdWString()); + #elif defined(Q_OS_MACOS) || defined(Q_OS_LINUX) + base::FilePath database(databasePath.toStdString()); + base::FilePath handler(handlerPath.toStdString()); + #endif // URL used to submit minidumps to std::string url(CRASHPAD_BACKEND_URL); @@ -58,7 +66,7 @@ namespace { QtSystemExceptionHandler systemExceptionHandler(libexecPath); #endif //#ifdef ENABLE_QT_BREAKPAD #else //#if defined(ENABLE_CRASHPAD) && defined(Q_OS_WIN) - bool startCrashpad() + bool startCrashpad(const QString&, const QString&) { return false; } diff --git a/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp b/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp index 8a3822a86e..f2d9ff405f 100644 --- a/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp +++ b/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp @@ -16,6 +16,7 @@ #include <QFileInfo> #include <QQmlComponent> #include <QQmlEngine> +#include <QSettings> #if defined(Q_OS_WIN) && defined(QT_NO_DEBUG) #include <Windows.h> @@ -75,6 +76,24 @@ void QmlPuppet::populateParser() {"import3dAsset", "Import 3d asset.", "sourceAsset, outDir, importOptJson"}}); } +// should be in sync with coreplugin/icore.cpp -> FilePath ICore::crashReportsPath() +// and src\app\main.cpp +QString crashReportsPath() +{ + QSettings settings( + QSettings::IniFormat, + QSettings::UserScope, + QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), + QLatin1String(Core::Constants::IDE_CASED_ID)); + +#if defined(Q_OS_MACOS) + return QFileInfo(settings.fileName()).path() + "/crashpad_reports"; +#else + return QCoreApplication::applicationDirPath() + + '/' + RELATIVE_LIBEXEC_PATH + "crashpad_reports"; +#endif +} + void QmlPuppet::initQmlRunner() { if (m_coreApp->arguments().count() < 2 @@ -117,7 +136,8 @@ void QmlPuppet::initQmlRunner() Import3D::import3D(sourceAsset, outDir, options); } - startCrashpad(); + startCrashpad(QCoreApplication::applicationDirPath() + + '/' + RELATIVE_LIBEXEC_PATH, crashReportsPath()); new QmlDesigner::Qt5NodeInstanceClientProxy(m_coreApp.get()); |
