From 8c2cde4c135f9766bae53168ebb43b21fdf0eb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20L?= Date: Sun, 21 Apr 2019 09:59:52 +0200 Subject: [PATCH] SetRecordingFolder: fix docs + simplify helper function --- src/Utils.cpp | 12 ++++-------- src/WSRequestHandler_Recording.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 840e2e31..0fe2fd8e 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -419,17 +419,13 @@ const char* Utils::GetRecordingFolder() { bool Utils::SetRecordingFolder(const char* path) { QDir dir(path); - if (!dir.exists()) + if (!dir.exists()) { dir.mkpath("."); + } config_t* profile = obs_frontend_get_profile_config(); - QString outputMode = config_get_string(profile, "Output", "Mode"); - - if (outputMode == "Advanced") { - config_set_string(profile, "AdvOut", "RecFilePath", path); - } else { - config_set_string(profile, "SimpleOutput", "FilePath", path); - } + config_set_string(profile, "AdvOut", "RecFilePath", path); + config_set_string(profile, "SimpleOutput", "FilePath", path); config_save(profile); return true; diff --git a/src/WSRequestHandler_Recording.cpp b/src/WSRequestHandler_Recording.cpp index 68bc0899..b8600935 100644 --- a/src/WSRequestHandler_Recording.cpp +++ b/src/WSRequestHandler_Recording.cpp @@ -56,8 +56,14 @@ HandlerResponse WSRequestHandler::HandleStartRecording(WSRequestHandler* req) { } /** - * Change the current recording folder. - * + * In the current profile, sets the recording folder of the Simple and Advanced + * output modes to the specified value. + * + * Please note: if `SetRecordingFolder` is called while a recording is + * in progress, the change won't be applied immediately and will be + * effective on the next recording. + * + * * @param {String} `rec-folder` Path of the recording folder. * * @api requests