浏览代码

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.
tt2468 4 年之前
父节点
当前提交
502bc3bf0a
共有 3 个文件被更改,包括 22 次插入1 次删除
  1. 19 0
      UI/obs-app.cpp
  2. 1 0
      UI/obs-app.hpp
  3. 2 1
      UI/window-basic-main.cpp

+ 19 - 0
UI/obs-app.cpp

@@ -90,6 +90,7 @@ bool opt_allow_opengl = false;
 bool opt_always_on_top = false;
 bool opt_always_on_top = false;
 bool opt_disable_high_dpi_scaling = false;
 bool opt_disable_high_dpi_scaling = false;
 bool opt_disable_updater = false;
 bool opt_disable_updater = false;
+bool opt_disable_missing_files_check = false;
 string opt_starting_collection;
 string opt_starting_collection;
 string opt_starting_profile;
 string opt_starting_profile;
 string opt_starting_scene;
 string opt_starting_scene;
@@ -1497,6 +1498,11 @@ bool OBSApp::IsUpdaterDisabled()
 	return opt_disable_updater;
 	return opt_disable_updater;
 }
 }
 
 
+bool OBSApp::IsMissingFilesCheckDisabled()
+{
+	return opt_disable_missing_files_check;
+}
+
 #ifdef __APPLE__
 #ifdef __APPLE__
 #define INPUT_AUDIO_SOURCE "coreaudio_input_capture"
 #define INPUT_AUDIO_SOURCE "coreaudio_input_capture"
 #define OUTPUT_AUDIO_SOURCE "coreaudio_output_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)) {
 		} else if (arg_is(argv[i], "--disable-updater", nullptr)) {
 			opt_disable_updater = true;
 			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",
 		} else if (arg_is(argv[i], "--disable-high-dpi-scaling",
 				  nullptr)) {
 				  nullptr)) {
 			opt_disable_high_dpi_scaling = true;
 			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"
 				"--always-on-top: Start in 'always on top' mode.\n\n"
 				"--unfiltered_log: Make log unfiltered.\n\n"
 				"--unfiltered_log: Make log unfiltered.\n\n"
 				"--disable-updater: Disable built-in updater (Windows/Mac only)\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";
 				"--disable-high-dpi-scaling: Disable automatic high-DPI scaling\n\n";
 
 
 #ifdef _WIN32
 #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") ||
 			os_file_exists(BASE_PATH "/disable_updater.txt");
 			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
 #endif
 
 
 	upgrade_settings();
 	upgrade_settings();

+ 1 - 0
UI/obs-app.hpp

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

+ 2 - 1
UI/window-basic-main.cpp

@@ -1173,7 +1173,8 @@ retryScene:
 
 
 	LogScenes();
 	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,
 		/* the window hasn't fully initialized by this point on macOS,
 		 * so put this at the end of the current task queue. Fixes a
 		 * so put this at the end of the current task queue. Fixes a
 		 * bug where the window be behind OBS on startup */
 		 * bug where the window be behind OBS on startup */