浏览代码

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 年之前
父节点
当前提交
b654dba30a
共有 1 个文件被更改,包括 6 次插入1 次删除
  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;
 }