diff options
| author | Eran Mizrahi <erasmux@gmail.com> | 2017-12-12 23:22:04 +0200 |
|---|---|---|
| committer | Eran Mizrahi <erasmux@gmail.com> | 2017-12-12 23:22:04 +0200 |
| commit | 240900de39aaf1562332ed88708b4b128703ad0e (patch) | |
| tree | 8b4a258adbc1df8b0bbaa9b2e4d2b617cd8f1cfb | |
| parent | 2c69f9c407ec803c3c99713fe591717ebcee191b (diff) | |
Move crash dumps to instance-dependant data folder
| -rw-r--r-- | src/main.cpp | 5 | ||||
| -rw-r--r-- | src/organizercore.cpp | 9 | ||||
| -rw-r--r-- | src/settings.cpp | 12 | ||||
| -rw-r--r-- | src/settings.h | 2 | ||||
| -rw-r--r-- | src/settingsdialog.ui | 9 | ||||
| -rw-r--r-- | src/shared/appconfig.inc | 1 |
6 files changed, 27 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp index eed4dfd3..b4faf570 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -528,8 +528,6 @@ int runApplication(MOApplication &application, SingleInstance &instance, int main(int argc, char *argv[])
{
- prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
-
MOApplication application(argc, argv);
QStringList arguments = application.arguments();
@@ -586,6 +584,9 @@ int main(int argc, char *argv[]) }
application.setProperty("dataPath", dataPath);
+ // initialize dump collection only after "dataPath" since the crashes are stored under it
+ prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
+
LogBuffer::init(100, QtDebugMsg, qApp->property("dataPath").toString() + "/logs/mo_interface.log");
QString splash = dataPath + "/splash.png";
diff --git a/src/organizercore.cpp b/src/organizercore.cpp index bc0578b3..deb0b718 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -670,11 +670,10 @@ void OrganizerCore::setGlobalCrashDumpsType(int crashDumpsType) { //static
std::wstring OrganizerCore::crashDumpsPath() {
- wchar_t appDataLocal[MAX_PATH]{ 0 };
- ::SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, appDataLocal);
- std::wstring dumpPath{ appDataLocal };
- dumpPath += L"\\modorganizer\\crashDumps";
- return dumpPath;
+ return (
+ qApp->property("dataPath").toString() + "/"
+ + QString::fromStdWString(AppConfig::dumpsDir())
+ ).toStdWString();
}
void OrganizerCore::setCurrentProfile(const QString &profileName)
diff --git a/src/settings.cpp b/src/settings.cpp index 05a62591..b2fc8939 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settingsdialog.h" #include "versioninfo.h" #include "appconfig.h" +#include "organizercore.h" #include <utility.h> #include <iplugin.h> #include <iplugingame.h> @@ -48,6 +49,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QDir> #include <QStringList> #include <QVariantMap> +#include <QLabel> #include <Qt> // for Qt::UserRole, etc #include <QtDebug> // for qDebug, qWarning @@ -755,10 +757,20 @@ Settings::DiagnosticsTab::DiagnosticsTab(Settings *m_parent, SettingsDialog &m_d , m_logLevelBox(m_dialog.findChild<QComboBox *>("logLevelBox")) , m_dumpsTypeBox(m_dialog.findChild<QComboBox *>("dumpsTypeBox")) , m_dumpsMaxEdit(m_dialog.findChild<QSpinBox *>("dumpsMaxEdit")) + , m_diagnosticsExplainedLabel(m_dialog.findChild<QLabel *>("diagnosticsExplainedLabel")) { m_logLevelBox->setCurrentIndex(m_parent->logLevel()); m_dumpsTypeBox->setCurrentIndex(m_parent->crashDumpsType()); m_dumpsMaxEdit->setValue(m_parent->crashDumpsMax()); + QString logsPath = qApp->property("dataPath").toString() + + "/" + QString::fromStdWString(AppConfig::logPath()); + m_diagnosticsExplainedLabel->setText( + m_diagnosticsExplainedLabel->text() + .replace("LOGS_FULL_PATH", logsPath) + .replace("LOGS_DIR", QString::fromStdWString(AppConfig::logPath())) + .replace("DUMPS_FULL_PATH", QString::fromStdWString(OrganizerCore::crashDumpsPath())) + .replace("DUMPS_DIR", QString::fromStdWString(AppConfig::dumpsDir())) + ); } void Settings::DiagnosticsTab::update() diff --git a/src/settings.h b/src/settings.h index 9ee29ba3..ae38223f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -41,6 +41,7 @@ class QLineEdit; class QSpinBox; class QListWidget; class QWidget; +class QLabel; struct ServerInfo; @@ -414,6 +415,7 @@ private: QComboBox *m_logLevelBox; QComboBox *m_dumpsTypeBox; QSpinBox *m_dumpsMaxEdit; + QLabel *m_diagnosticsExplainedLabel; }; /** Display/store the configuration in the 'nexus' tab of the settings dialogue */ diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 6d462cfa..7a902748 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -483,12 +483,13 @@ If you use pre-releases, never contact me directly by e-mail or via private mess </layout>
</item>
<item row="4" column="0">
- <widget class="QLabel" name="label_29">
+ <widget class="QLabel" name="diagnosticsExplainedLabel">
<property name="text">
<string>
- Dumps are stored in <a href="%LOCALAPPDATA%\modorganizer\crashDumps">%LOCALAPPDATA%\modorganizer\crashDumps</a>.
- Sending such dumps to the developers can help solve crashes caused by MO.
- It is recommended to compress the dumps before sending, especially on the larger settings.
+ Logs and crash dumps are stored under your current instance in the <a href="LOGS_FULL_PATH">LOGS_DIR</a>
+ and <a href="DUMPS_FULL_PATH">DUMPS_DIR</a> folders.
+ Sending logs and/or crash dumps to the developers can help investigate issues.
+ It is recommended to compress large log and dmp files before sending.
</string>
</property>
<property name="wordWrap">
diff --git a/src/shared/appconfig.inc b/src/shared/appconfig.inc index e98757d3..e572a32b 100644 --- a/src/shared/appconfig.inc +++ b/src/shared/appconfig.inc @@ -8,6 +8,7 @@ APPPARAM(std::wstring, stylesheetsPath, L"stylesheets") APPPARAM(std::wstring, cachePath, L"webcache")
APPPARAM(std::wstring, tutorialsPath, L"tutorials")
APPPARAM(std::wstring, logPath, L"logs")
+APPPARAM(std::wstring, dumpsDir, L"crashDumps")
APPPARAM(std::wstring, profileTweakIni, L"profile_tweaks.ini")
APPPARAM(std::wstring, logFileName, L"ModOrganizer.log")
APPPARAM(std::wstring, iniFileName, L"ModOrganizer.ini")
|
