From 502bc3bf0a6d2003af5f21ebbfe9a4812cf9706d Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 13 Apr 2021 00:00:13 -0700 Subject: [PATCH] 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. --- UI/obs-app.cpp | 19 +++++++++++++++++++ UI/obs-app.hpp | 1 + UI/window-basic-main.cpp | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 4369c9737..0c4d597a7 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -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(); diff --git a/UI/obs-app.hpp b/UI/obs-app.hpp index 4f681f394..6592d5bbc 100644 --- a/UI/obs-app.hpp +++ b/UI/obs-app.hpp @@ -150,6 +150,7 @@ public: std::string GetVersionString() const; bool IsPortableMode(); bool IsUpdaterDisabled(); + bool IsMissingFilesCheckDisabled(); const char *InputAudioSource() const; const char *OutputAudioSource() const; diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index a398f9d24..54e1002a8 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -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 */