UI: Add startup flag to disable missing files window

Adds a startup flag (--disable-missing-files-check) to disable the
missing files dialog from appearing on load. For some users, the
missing files dialog may interfere with automation of OBS, or the
user may also purposefully have missing files in their scene
collection which they do not want to be warned about.
This commit is contained in:
tt2468 2021-04-13 00:00:13 -07:00 committed by Dillon Pentz
parent 9ca70f4470
commit 502bc3bf0a
3 changed files with 22 additions and 1 deletions

View file

@ -90,6 +90,7 @@ bool opt_allow_opengl = false;
bool opt_always_on_top = false;
bool opt_disable_high_dpi_scaling = false;
bool opt_disable_updater = false;
bool opt_disable_missing_files_check = false;
string opt_starting_collection;
string opt_starting_profile;
string opt_starting_scene;
@ -1497,6 +1498,11 @@ bool OBSApp::IsUpdaterDisabled()
return opt_disable_updater;
}
bool OBSApp::IsMissingFilesCheckDisabled()
{
return opt_disable_missing_files_check;
}
#ifdef __APPLE__
#define INPUT_AUDIO_SOURCE "coreaudio_input_capture"
#define OUTPUT_AUDIO_SOURCE "coreaudio_output_capture"
@ -2697,6 +2703,10 @@ int main(int argc, char *argv[])
} else if (arg_is(argv[i], "--disable-updater", nullptr)) {
opt_disable_updater = true;
} else if (arg_is(argv[i], "--disable-missing-files-check",
nullptr)) {
opt_disable_missing_files_check = true;
} else if (arg_is(argv[i], "--disable-high-dpi-scaling",
nullptr)) {
opt_disable_high_dpi_scaling = true;
@ -2720,6 +2730,7 @@ int main(int argc, char *argv[])
"--always-on-top: Start in 'always on top' mode.\n\n"
"--unfiltered_log: Make log unfiltered.\n\n"
"--disable-updater: Disable built-in updater (Windows/Mac only)\n\n"
"--disable-missing-files-check: Disable the missing files dialog which can appear on startup.\n\n"
"--disable-high-dpi-scaling: Disable automatic high-DPI scaling\n\n";
#ifdef _WIN32
@ -2752,6 +2763,14 @@ int main(int argc, char *argv[])
os_file_exists(BASE_PATH "/disable_updater") ||
os_file_exists(BASE_PATH "/disable_updater.txt");
}
if (!opt_disable_missing_files_check) {
opt_disable_missing_files_check =
os_file_exists(BASE_PATH
"/disable_missing_files_check") ||
os_file_exists(BASE_PATH
"/disable_missing_files_check.txt");
}
#endif
upgrade_settings();

View file

@ -150,6 +150,7 @@ public:
std::string GetVersionString() const;
bool IsPortableMode();
bool IsUpdaterDisabled();
bool IsMissingFilesCheckDisabled();
const char *InputAudioSource() const;
const char *OutputAudioSource() const;

View file

@ -1173,7 +1173,8 @@ retryScene:
LogScenes();
if (obs_missing_files_count(files) > 0) {
if (obs_missing_files_count(files) > 0 &&
!App()->IsMissingFilesCheckDisabled()) {
/* the window hasn't fully initialized by this point on macOS,
* so put this at the end of the current task queue. Fixes a
* bug where the window be behind OBS on startup */