diff options
-rw-r--r-- | src/app/main.cpp | 15 | ||||
-rw-r--r-- | src/plugins/coreplugin/icore.cpp | 2 | ||||
-rw-r--r-- | src/tools/qml2puppet/qml2puppet/configcrashpad.h | 16 | ||||
-rw-r--r-- | src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp | 22 |
4 files changed, 48 insertions, 7 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index 74d1ccec9e6..d1cfc7136a8 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -425,13 +425,26 @@ QStringList lastSessionArgument() return hasProjectExplorer ? QStringList({"-lastsession"}) : QStringList(); } +// should be in sync with src/plugins/coreplugin/icore.cpp -> FilePath ICore::crashReportsPath() +// and src\tools\qml2puppet\qml2puppet\qmlpuppet.cpp -> QString crashReportsPath() +QString crashReportsPath() +{ + std::unique_ptr<QSettings> settings(createUserSettings()); + QFileInfo(settings->fileName()).path() + "/crashpad_reports"; + if (Utils::HostOsInfo::isMacHost()) + return QFileInfo(createUserSettings()->fileName()).path() + "/crashpad_reports"; + else + return QCoreApplication::applicationDirPath() + + '/' + RELATIVE_LIBEXEC_PATH + "crashpad_reports"; +} + #ifdef ENABLE_CRASHPAD bool startCrashpad(const QString &libexecPath, bool crashReportingEnabled) { using namespace crashpad; // Cache directory that will store crashpad information and minidumps - QString databasePath = QDir::cleanPath(libexecPath + "/crashpad_reports"); + QString databasePath = QDir::cleanPath(crashReportsPath()); QString handlerPath = QDir::cleanPath(libexecPath + "/crashpad_handler"); #ifdef Q_OS_WIN handlerPath += ".exe"; diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 6d8a35b62c6..2fed2593146 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -511,7 +511,7 @@ FilePath ICore::libexecPath(const QString &rel) FilePath ICore::crashReportsPath() { if (Utils::HostOsInfo::isMacHost()) - return libexecPath("crashpad_reports/completed"); + return Core::ICore::userResourcePath("crashpad_reports/completed"); else return libexecPath("crashpad_reports/reports"); } diff --git a/src/tools/qml2puppet/qml2puppet/configcrashpad.h b/src/tools/qml2puppet/qml2puppet/configcrashpad.h index 7b663b84498..d6ecc8af4f5 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 8a3822a86e7..f2d9ff405f0 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()); |