From 046464884abd585dd03b98aa8fca569fb2f58aef Mon Sep 17 00:00:00 2001 From: Lqlsoftware Date: Fri, 27 Dec 2019 17:12:31 +0800 Subject: [PATCH] UI: Properly inform user if recording path is invalid --- UI/window-basic-main.cpp | 20 ++++++++++++++++++++ UI/window-basic-main.hpp | 3 +++ 2 files changed, 23 insertions(+) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 1ed02c9e7..03dae45eb 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -5416,6 +5416,12 @@ void OBSBasic::StartRecording() if (disableOutputsRef) return; + if (!OutputPathValid()) { + OutputPathInvalidMessage(); + ui->recordButton->setChecked(false); + return; + } + if (LowDiskSpace()) { DiskSpaceMessage(); ui->recordButton->setChecked(false); @@ -7655,6 +7661,20 @@ const char *OBSBasic::GetCurrentOutputPath() return path; } +void OBSBasic::OutputPathInvalidMessage() +{ + blog(LOG_ERROR, "Recording stopped because of bad output path"); + + OBSMessageBox::critical(this, QTStr("Output.BadPath.Title"), + QTStr("Output.BadPath.Text")); +} + +bool OBSBasic::OutputPathValid() +{ + const char *path = GetCurrentOutputPath(); + return path && *path && QDir(path).exists(); +} + void OBSBasic::DiskSpaceMessage() { blog(LOG_ERROR, "Recording stopped because of low disk space"); diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index 5944c2a17..a0fd0256e 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -683,6 +683,9 @@ private: void UpdatePause(bool activate = true); void UpdateReplayBuffer(bool activate = true); + bool OutputPathValid(); + void OutputPathInvalidMessage(); + bool LowDiskSpace(); void DiskSpaceMessage();