Prechádzať zdrojové kódy

UI: Catch error from copy in MigrateGlobalSettings

During development on FreeBSD I encountered an uncaught exception abort
from the copy in MigrateGlobalSettings.  Catch the error and print a
user-facing message:

error: Unable to migrate global configuration - copy failed.
Ed Maste 1 rok pred
rodič
commit
b654dba30a
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      UI/obs-app.cpp

+ 6 - 1
UI/obs-app.cpp

@@ -768,7 +768,12 @@ bool OBSApp::MigrateGlobalSettings()
 		return false;
 	}
 
-	std::filesystem::copy(legacyGlobalConfigFile, userConfigFile);
+	try {
+		std::filesystem::copy(legacyGlobalConfigFile, userConfigFile);
+	} catch (const std::filesystem::filesystem_error &) {
+		OBSErrorBox(nullptr, "Unable to migrate global configuration - copy failed.");
+		return false;
+	}
 
 	return true;
 }