From 042d9f18f7e0110937e4f631cf53570c540a6ea9 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Thu, 7 Dec 2017 10:06:05 -0500 Subject: [PATCH] Clears BYOND cache on every reboot --- TGS.Server/Instance/Byond.cs | 17 +++++++++++++++++ TGS.Server/Instance/DreamDaemon.cs | 1 + 2 files changed, 18 insertions(+) diff --git a/TGS.Server/Instance/Byond.cs b/TGS.Server/Instance/Byond.cs index 04790bca9d..cc44646502 100644 --- a/TGS.Server/Instance/Byond.cs +++ b/TGS.Server/Instance/Byond.cs @@ -53,6 +53,11 @@ namespace TGS.Server /// const string ByondNoPromptTrustedMode = "trusted-check 0"; + /// + /// Contains cache shit that needs to be cleared out every startup + /// + static readonly string ByondCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ByondDirectory, "cache"); + /// /// The status of the BYOND updater /// @@ -103,6 +108,18 @@ namespace TGS.Server CleanByondStaging(); } } + + /// + /// Attempts to clear the + /// + void ClearCacheFolder() + { + try + { + Helpers.DeleteDirectory(ByondCacheDirectory, true, null); + } + catch { } + } /// /// Checks if the updater is considered busy diff --git a/TGS.Server/Instance/DreamDaemon.cs b/TGS.Server/Instance/DreamDaemon.cs index 0e056f30fe..805c315d09 100644 --- a/TGS.Server/Instance/DreamDaemon.cs +++ b/TGS.Server/Instance/DreamDaemon.cs @@ -605,6 +605,7 @@ namespace TGS.Server StartingSecurity = Config.Security; Proc.StartInfo.Arguments = String.Format("{0} -port {1} {5}-close -verbose -params \"server_service={3}&server_service_version={4}&{6}={7}\" -{2} -public", DMB, Config.Port, SecurityWord(), serviceCommsKey, Version(), Config.Webclient ? "-webclient " : "", SPInstanceName, Config.Name); UpdateBridgeDll(true); + ClearCacheFolder(); lock (topicLock) { GameAPIVersion = null; //needs updating