/// <summary> /// This method will generate and apply a modified qt.pro.user file, which contains build presets for UE4 /// </summary> /// <param name="projData">Reference to project parser</param> /// <returns>success</returns> public static void GenerateQtBuildPreset(ProjectFileParser projData) { // Helper variable which stores the retrieved Unreal Engine Version (currently not needed) //string UnrealVersion; // These variables are used to replace parts of the qtBuildPreset.xml file to match your project and Unreal Engine installation string UPROJ_FILE, UNREAL_PATH, PROJECT_DIR, PROJECT_NAME, QT_ENV_ID, QT_CONF_ID; QT_ENV_ID = Configuration.data.qtCreatorEnvironmentId; QT_CONF_ID = Configuration.data.qtCreatorUnrealConfigurationId; // Set project name PROJECT_NAME = projData.projectName; // Set project directory PROJECT_DIR = projData.projectPath; // Set project file path UPROJ_FILE = projData.uprojectFilePath; // set engine path UNREAL_PATH = projData.GetEnginePath(); // Load user file preset String qtBuildPreset = ""; try { qtBuildPreset = File.ReadAllText(FileActions.PROGRAM_DIR + "qtBuildPreset.xml"); } catch { Errors.ErrorExit(ErrorCode.BUILD_PRESET_READ_FAILED); } // Replace preset variables with actual values qtBuildPreset = qtBuildPreset.Replace("$PROJECT_NAME", PROJECT_NAME); qtBuildPreset = qtBuildPreset.Replace("$PROJECT_DIR", PROJECT_DIR); qtBuildPreset = qtBuildPreset.Replace("$UPROJ_FILE", UPROJ_FILE); qtBuildPreset = qtBuildPreset.Replace("$UNREAL_PATH", UNREAL_PATH); qtBuildPreset = qtBuildPreset.Replace("$QT_ENV_ID", QT_ENV_ID); qtBuildPreset = qtBuildPreset.Replace("$QT_CONF_ID", QT_CONF_ID); // remove -rocket for custom engine builds if (!projData.IsLauncherBuild()) { qtBuildPreset = qtBuildPreset.Replace("-rocket", ""); } // Write new user file try { File.WriteAllText(projData.projectPath + "Intermediate\\ProjectFiles\\" + projData.projectName + ".pro.user", qtBuildPreset); } catch { Errors.ErrorExit(ErrorCode.QT_PRO_USERFILE_WRITE_FAILED); } Console.WriteLine("User file written successfully."); }