diff --git a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs
index 3383095534..c78e65f710 100644
--- a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs
+++ b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs
@@ -22,9 +22,14 @@ namespace Tgstation.Server.Host.Components.Byond
public const string BinPath = "byond/bin";
///
- /// The path to the BYOND bin folder
+ /// The path to the cfg directory.
///
- const string TrustedDmbListPath = "byond/cfg/trusted.txt";
+ const string CfgDirectoryName = "cfg";
+
+ ///
+ /// The name of the list of trusted .dmb files in the user's BYOND cfg directory.
+ ///
+ const string TrustedDmbFileName = "trusted.txt";
///
/// The file in which we store the for installations
@@ -205,14 +210,25 @@ namespace Tgstation.Server.Host.Components.Byond
await InstallVersion(versionToUse, cancellationToken).ConfigureAwait(false);
var versionKey = VersionKey(versionToUse);
+ var binPathForVersion = ioManager.ConcatPath(versionKey, BinPath);
return new ByondExecutableLock(
ioManager,
semaphore,
versionToUse,
- ioManager.ResolvePath(ioManager.ConcatPath(versionKey, BinPath, byondInstaller.DreamDaemonName)),
- ioManager.ResolvePath(ioManager.ConcatPath(versionKey, BinPath, byondInstaller.DreamMakerName)),
- ioManager.ResolvePath(ioManager.ConcatPath(versionKey, TrustedDmbListPath)));
+ ioManager.ResolvePath(
+ ioManager.ConcatPath(
+ binPathForVersion,
+ byondInstaller.DreamDaemonName)),
+ ioManager.ResolvePath(
+ ioManager.ConcatPath(
+ binPathForVersion,
+ byondInstaller.DreamMakerName)),
+ ioManager.ResolvePath(
+ ioManager.ConcatPath(
+ byondInstaller.PathToUserByondFolder,
+ CfgDirectoryName,
+ TrustedDmbFileName)));
}
///
@@ -226,6 +242,24 @@ namespace Tgstation.Server.Host.Components.Byond
var activeVersionBytesTask = GetActiveVersion();
+ // Create local cfg directory in case it doesn't exist
+ var localCfgDirectory = ioManager.ConcatPath(
+ byondInstaller.PathToUserByondFolder,
+ CfgDirectoryName);
+ await ioManager.CreateDirectory(
+ localCfgDirectory,
+ cancellationToken).ConfigureAwait(false);
+
+ // No need to do this on dev machines
+#if !DEBUG
+ // Delete trusted.txt so it doesn't grow too large
+ await ioManager.DeleteFile(
+ ioManager.ConcatPath(
+ localCfgDirectory,
+ TrustedDmbFileName),
+ cancellationToken).ConfigureAwait(false);
+#endif
+
await ioManager.CreateDirectory(".", cancellationToken).ConfigureAwait(false);
var directories = await ioManager.GetDirectories(".", cancellationToken).ConfigureAwait(false);
@@ -239,9 +273,6 @@ namespace Tgstation.Server.Host.Components.Byond
return;
}
- // Delete trusted.txt so it doesn't grow too large
- await ioManager.DeleteFile(ioManager.ConcatPath(path, TrustedDmbListPath), cancellationToken).ConfigureAwait(false);
-
var bytes = await ioManager.ReadAllBytes(versionFile, cancellationToken).ConfigureAwait(false);
var text = Encoding.UTF8.GetString(bytes);
if (Version.TryParse(text, out var version))