Browse Source

UI: Check and fail when launched under ChromeOS

This adds a check when compiling for linux to check for a ChromeOS
container specific directory. If this directory exists OBS will fail to
start with an error that ChromeOS is unsupported.
Kurt Kartaltepe 5 years ago
parent
commit
a52b53e98e
2 changed files with 19 additions and 0 deletions
  1. 3 0
      UI/data/locale/en-US.ini
  2. 16 0
      UI/obs-app.cpp

+ 3 - 0
UI/data/locale/en-US.ini

@@ -102,6 +102,9 @@ AlreadyRunning.Title="OBS is already running"
 AlreadyRunning.Text="OBS is already running! Unless you meant to do this, please shut down any existing instances of OBS before trying to run a new instance. If you have OBS set to minimize to the system tray, please check to see if it's still running there."
 AlreadyRunning.LaunchAnyway="Launch Anyway"
 
+ChromeOS.Title="Unsupported Platform"
+ChromeOS.Text="OBS appears to be running inside a ChromeOS container. This platform is unsupported"
+
 # warning when closing docks. it's frustrating that we actually need this.
 DockCloseWarning.Title="Closing Dockable Window"
 DockCloseWarning.Text="You just closed a dockable window. If you'd like to show it again, use the View → Docks menu on the menu bar."

+ 16 - 0
UI/obs-app.cpp

@@ -1987,6 +1987,22 @@ static int run_program(fstream &logFile, int argc, char *argv[])
 	run:
 #endif
 
+#if !defined(_WIN32) && !defined(__APPLE__)
+		// Mounted by termina during chromeOS linux container startup
+		// https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/project-termina/chromeos-base/termina-lxd-scripts/files/lxd_setup.sh
+		os_dir_t *crosDir = os_opendir("/opt/google/cros-containers");
+		if (crosDir) {
+			QMessageBox::StandardButtons buttons(QMessageBox::Ok);
+			QMessageBox mb(QMessageBox::Critical,
+				       QTStr("ChromeOS.Title"),
+				       QTStr("ChromeOS.Text"), buttons,
+				       nullptr);
+
+			mb.exec();
+			return 0;
+		}
+#endif
+
 		if (!created_log) {
 			create_log_file(logFile);
 			created_log = true;