Preserve current state before big refactor

This commit is contained in:
2025-02-05 20:45:49 -08:00
parent 4910ff7770
commit badc6d2375
65 changed files with 2356 additions and 113 deletions

View File

@@ -0,0 +1,53 @@
using System;
using System.Diagnostics;
using Godot;
namespace Laura.DeployToSteamOS;
public class GodotExportManager
{
public static void ExportProject(
string projectPath,
string outputPath,
bool isReleaseBuild,
Callable logCallable,
Action OnProcessExited = null)
{
logCallable.CallDeferred("Starting project export, this may take a while.");
logCallable.CallDeferred($"Output path: {outputPath}");
logCallable.CallDeferred($"Is Release Build: {(isReleaseBuild ? "Yes" : "No")}");
Process exportProcess = new Process();
exportProcess.StartInfo.FileName = OS.GetExecutablePath();
var arguments = $"--headless --path \"{projectPath}\" ";
arguments += isReleaseBuild ? "--export-release " : "--export-debug ";
arguments += "\"Steamdeck\" ";
arguments += $"\"{outputPath}\"";
exportProcess.StartInfo.Arguments = arguments;
exportProcess.StartInfo.UseShellExecute = false;
exportProcess.StartInfo.RedirectStandardOutput = true;
exportProcess.EnableRaisingEvents = true;
exportProcess.ErrorDataReceived += (sender, args) =>
{
throw new Exception("Error while building project: " + args.Data);
};
exportProcess.OutputDataReceived += (sender, args) =>
{
logCallable.CallDeferred(args.Data);
};
exportProcess.Exited += (sender, args) =>
{
OnProcessExited?.Invoke();
exportProcess.WaitForExit();
};
exportProcess.Start();
exportProcess.BeginOutputReadLine();
}
}