diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini
index c3222abe4..7ef459344 100644
--- a/UI/data/locale/en-US.ini
+++ b/UI/data/locale/en-US.ini
@@ -96,6 +96,7 @@ AspectRatio="Aspect Ratio %1:%2"
LockVolume="Lock Volume"
LogViewer="Log Viewer"
ShowOnStartup="Show on startup"
+OpenFile="Open file"
# warning if program already open
AlreadyRunning.Title="OBS is already running"
diff --git a/UI/log-viewer.cpp b/UI/log-viewer.cpp
index 554c0535c..2bda3dc5d 100644
--- a/UI/log-viewer.cpp
+++ b/UI/log-viewer.cpp
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include
#include "log-viewer.hpp"
@@ -29,6 +30,9 @@ OBSLogViewer::OBSLogViewer(QWidget *parent) : QDialog(parent)
QPushButton *clearButton = new QPushButton(QTStr("Clear"));
connect(clearButton, &QPushButton::clicked, this,
&OBSLogViewer::ClearText);
+ QPushButton *openButton = new QPushButton(QTStr("OpenFile"));
+ connect(openButton, &QPushButton::clicked, this,
+ &OBSLogViewer::OpenFile);
QPushButton *closeButton = new QPushButton(QTStr("Close"));
connect(closeButton, &QPushButton::clicked, this, &QDialog::hide);
@@ -40,6 +44,7 @@ OBSLogViewer::OBSLogViewer(QWidget *parent) : QDialog(parent)
buttonLayout->addSpacing(10);
buttonLayout->addWidget(showStartup);
buttonLayout->addStretch();
+ buttonLayout->addWidget(openButton);
buttonLayout->addWidget(clearButton);
buttonLayout->addWidget(closeButton);
buttonLayout->addSpacing(10);
@@ -143,3 +148,19 @@ void OBSLogViewer::ClearText()
{
textArea->clear();
}
+
+void OBSLogViewer::OpenFile()
+{
+ char logDir[512];
+ if (GetConfigPath(logDir, sizeof(logDir), "obs-studio/logs") <= 0)
+ return;
+
+ const char *log = App()->GetCurrentLog();
+
+ std::string path = logDir;
+ path += "/";
+ path += log;
+
+ QUrl url = QUrl::fromLocalFile(QT_UTF8(path.c_str()));
+ QDesktopServices::openUrl(url);
+}
diff --git a/UI/log-viewer.hpp b/UI/log-viewer.hpp
index 3a73c8f2f..ed43828cf 100644
--- a/UI/log-viewer.hpp
+++ b/UI/log-viewer.hpp
@@ -15,6 +15,7 @@ private slots:
void AddLine(int type, const QString &text);
void ClearText();
void ToggleShowStartup(bool checked);
+ void OpenFile();
public:
OBSLogViewer(QWidget *parent = 0);