UI: Allow directories in file formatting settings
When configuring file formatting settings in advanced, allow the ability to specify formatted directories. For example, "%CCYY-%MM/%DD %hh-%mm-%ss" would make the year and month a subdirectory, then the day/hour/minute/seconds as the file name. January 21st 2121 at 4pm would end up being: "21 04-00-00.mp4" in the subdirectory "2121-01".
This commit is contained in:
parent
e9087cfdc9
commit
d7cf581b3a
2 changed files with 18 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <QMessageBox>
|
||||
#include "audio-encoders.hpp"
|
||||
#include "window-basic-main.hpp"
|
||||
|
|
@ -555,6 +556,18 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void ensure_directory_exists(string &path)
|
||||
{
|
||||
replace(path.begin(), path.end(), '\\', '/');
|
||||
|
||||
size_t last = path.rfind('/');
|
||||
if (last == string::npos)
|
||||
return;
|
||||
|
||||
string directory = path.substr(0, last);
|
||||
os_mkdirs(directory.c_str());
|
||||
}
|
||||
|
||||
bool SimpleOutput::StartRecording()
|
||||
{
|
||||
if (usingRecordingPreset) {
|
||||
|
|
@ -600,6 +613,7 @@ bool SimpleOutput::StartRecording()
|
|||
|
||||
strPath += GenerateSpecifiedFilename(ffmpegOutput ? "avi" : format,
|
||||
noSpace, filenameFormat);
|
||||
ensure_directory_exists(strPath);
|
||||
if (!overwriteIfExists)
|
||||
FindBestFilename(strPath, noSpace);
|
||||
|
||||
|
|
@ -1136,6 +1150,7 @@ bool AdvancedOutput::StartRecording()
|
|||
|
||||
strPath += GenerateSpecifiedFilename(recFormat, noSpace,
|
||||
filenameFormat);
|
||||
ensure_directory_exists(strPath);
|
||||
if (!overwriteIfExists)
|
||||
FindBestFilename(strPath, noSpace);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue