mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-08 08:39:55 -04:00
UI: Fix path calculation for disk space check
When using custom FFmpeg output mode, the check would instead use the standard recording path which is no longer visible in the settings. This commit also simplifies the checks by moving the duplicated code to a new function.
This commit is contained in:
@@ -7548,6 +7548,29 @@ void OBSBasic::UpdatePause(bool activate)
|
||||
#define MBYTES_LEFT_STOP_REC 50ULL
|
||||
#define MAX_BYTES_LEFT (MBYTES_LEFT_STOP_REC * MBYTE)
|
||||
|
||||
const char *OBSBasic::GetCurrentOutputPath()
|
||||
{
|
||||
const char *path = nullptr;
|
||||
const char *mode = config_get_string(Config(), "Output", "Mode");
|
||||
|
||||
if (strcmp(mode, "Advanced") == 0) {
|
||||
const char *advanced_mode =
|
||||
config_get_string(Config(), "AdvOut", "RecType");
|
||||
|
||||
if (strcmp(advanced_mode, "FFmpeg") == 0) {
|
||||
path = config_get_string(Config(), "AdvOut",
|
||||
"FFFilePath");
|
||||
} else {
|
||||
path = config_get_string(Config(), "AdvOut",
|
||||
"RecFilePath");
|
||||
}
|
||||
} else {
|
||||
path = config_get_string(Config(), "SimpleOutput", "FilePath");
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void OBSBasic::DiskSpaceMessage()
|
||||
{
|
||||
blog(LOG_ERROR, "Recording stopped because of low disk space");
|
||||
@@ -7558,12 +7581,11 @@ void OBSBasic::DiskSpaceMessage()
|
||||
|
||||
bool OBSBasic::LowDiskSpace()
|
||||
{
|
||||
const char *mode = config_get_string(Config(), "Output", "Mode");
|
||||
const char *path =
|
||||
strcmp(mode, "Advanced")
|
||||
? config_get_string(Config(), "SimpleOutput",
|
||||
"FilePath")
|
||||
: config_get_string(Config(), "AdvOut", "RecFilePath");
|
||||
const char *path;
|
||||
|
||||
path = GetCurrentOutputPath();
|
||||
if (!path)
|
||||
return false;
|
||||
|
||||
uint64_t num_bytes = os_get_free_disk_space(path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user