| 273 | } |
| 274 | |
| 275 | bool ProjectInfo::LoadOldProject(const String& projectPath) |
| 276 | { |
| 277 | // Open Xml file |
| 278 | xml_document doc; |
| 279 | const xml_parse_result result = doc.load_file((const PUGIXML_CHAR*)*projectPath); |
| 280 | if (result.status) |
| 281 | { |
| 282 | ShowProjectLoadError(TEXT("Xml file parsing error."), projectPath); |
| 283 | return true; |
| 284 | } |
| 285 | |
| 286 | // Get root node |
| 287 | const xml_node root = doc.child(PUGIXML_TEXT("Project")); |
| 288 | if (!root) |
| 289 | { |
| 290 | ShowProjectLoadError(TEXT("Missing Project root node in xml file."), projectPath); |
| 291 | return true; |
| 292 | } |
| 293 | |
| 294 | // Load data |
| 295 | Name = (const Char*)root.child_value(PUGIXML_TEXT("Name")); |
| 296 | ProjectPath = projectPath; |
| 297 | ProjectFolderPath = StringUtils::GetDirectoryName(projectPath); |
| 298 | DefaultScene = Guid::Empty; |
| 299 | const auto defaultScene = root.child_value(PUGIXML_TEXT("DefaultSceneId")); |
| 300 | if (defaultScene) |
| 301 | { |
| 302 | Guid::Parse((const Char*)defaultScene, DefaultScene); |
| 303 | } |
| 304 | DefaultSceneSpawn.Position = GetVector3FromXml(root, PUGIXML_TEXT("DefaultSceneSpawnPos"), Vector3::Zero); |
| 305 | DefaultSceneSpawn.Direction = Quaternion::Euler(GetVector3FromXml(root, PUGIXML_TEXT("DefaultSceneSpawnDir"), Vector3::Zero)) * Vector3::Forward; |
| 306 | MinEngineVersion = ::Version(0, 0, GetIntFromXml(root, PUGIXML_TEXT("MinVersionSupported"), 0)); |
| 307 | |
| 308 | // Always reference engine project |
| 309 | auto& flaxReference = References.AddOne(); |
| 310 | flaxReference.Name = TEXT("$(EnginePath)/Flax.flaxproj"); |
| 311 | flaxReference.Project = Load(Globals::StartupFolder / TEXT("Flax.flaxproj")); |
| 312 | if (!flaxReference.Project) |
| 313 | { |
| 314 | ShowProjectLoadError(TEXT("Failed to load Flax Engine project."), projectPath); |
| 315 | return true; |
| 316 | } |
| 317 | |
| 318 | return false; |
| 319 | } |
| 320 | |
| 321 | ProjectInfo* ProjectInfo::Load(const String& path) |
| 322 | { |
no test coverage detected