From fab05fdafc13d8dd86ac6bfa5e587ac727f76fd2 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Fri, 17 Nov 2023 21:41:22 -0500 Subject: [PATCH] Fix misuse of OD logging cvars --- .../Components/Engine/IEngineInstallation.cs | 2 +- .../Components/Engine/OpenDreamInstallation.cs | 11 ++++++++++- .../Components/Engine/OpenDreamInstaller.cs | 1 + .../Components/Session/SessionControllerFactory.cs | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Engine/IEngineInstallation.cs b/src/Tgstation.Server.Host/Components/Engine/IEngineInstallation.cs index af111b9a15..f9aecca33b 100644 --- a/src/Tgstation.Server.Host/Components/Engine/IEngineInstallation.cs +++ b/src/Tgstation.Server.Host/Components/Engine/IEngineInstallation.cs @@ -53,7 +53,7 @@ namespace Tgstation.Server.Host.Components.Engine /// The . /// The map of parameter s as a . Should NOT include the of . /// The . - /// The path to the log file, if any. + /// The full path to the log file, if any. /// The formatted arguments . string FormatServerArguments( IDmbProvider dmbProvider, diff --git a/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstallation.cs b/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstallation.cs index 8954643601..254861e69a 100644 --- a/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstallation.cs +++ b/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstallation.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Tgstation.Server.Api.Models; using Tgstation.Server.Api.Models.Internal; using Tgstation.Server.Host.Components.Deployment; +using Tgstation.Server.Host.IO; namespace Tgstation.Server.Host.Components.Engine { @@ -34,19 +35,27 @@ namespace Tgstation.Server.Host.Components.Engine /// public override Task InstallationTask { get; } + /// + /// The for the . + /// + readonly IIOManager ioManager; + /// /// Initializes a new instance of the class. /// + /// The value of . /// The value of . /// The value of . /// The value of . /// The value of . public OpenDreamInstallation( + IIOManager ioManager, string serverExePath, string compilerExePath, Task installationTask, EngineVersion version) { + this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager)); ServerExePath = serverExePath ?? throw new ArgumentNullException(nameof(serverExePath)); CompilerExePath = compilerExePath ?? throw new ArgumentNullException(nameof(compilerExePath)); InstallationTask = installationTask ?? throw new ArgumentNullException(nameof(installationTask)); @@ -70,7 +79,7 @@ namespace Tgstation.Server.Host.Components.Engine var parametersString = EncodeParameters(parameters, launchParameters); var loggingEnabled = logFilePath != null; - var arguments = $"--cvar {(loggingEnabled ? $"log.path=\"{logFilePath}\"" : "log.enabled=false")} --cvar net.port={launchParameters.Port.Value} --cvar opendream.topic_port=0 --cvar opendream.world_params=\"{parametersString}\" --cvar opendream.json_path=\"./{dmbProvider.DmbName}\""; + var arguments = $"--cvar {(loggingEnabled ? $"log.path=\"{ioManager.GetDirectoryName(logFilePath)}\" --cvar log.format=\"{ioManager.GetFileName(logFilePath)}\"" : "log.enabled=false")} --cvar log.runtimelog=false --cvar net.port={launchParameters.Port.Value} --cvar opendream.topic_port=0 --cvar opendream.world_params=\"{parametersString}\" --cvar opendream.json_path=\"./{dmbProvider.DmbName}\""; return arguments; } diff --git a/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs b/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs index da7a9fae08..1357836c58 100644 --- a/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs @@ -98,6 +98,7 @@ namespace Tgstation.Server.Host.Components.Engine CheckVersionValidity(version); GetExecutablePaths(path, out var serverExePath, out var compilerExePath); return new OpenDreamInstallation( + IOManager, serverExePath, compilerExePath, installationTask, diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index 3670e146b9..9cd7fa15aa 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -474,7 +474,7 @@ namespace Tgstation.Server.Host.Components.Session /// The . /// The . /// The secure string to use for the session. - /// The path to log DreamDaemon output to. + /// The full path to log DreamDaemon output to. /// If we are only validating the DMAPI then exiting. /// The for the operation. /// A resulting in the DreamDaemon .