Explorar o código

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 hai 1 ano
pai
achega
b654dba30a
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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;
 }