mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 04:57:17 +01:00
Merge pull request #1762 from tgstation/FixWindowsProfileCleanup [TGSDeploy]
v6.1.1: Fixxessseeeessss!!!!!
This commit is contained in:
+2
-2
@@ -9,8 +9,8 @@
|
||||
<TgsCommonLibraryVersion>7.0.0</TgsCommonLibraryVersion>
|
||||
<TgsApiLibraryVersion>13.0.1</TgsApiLibraryVersion>
|
||||
<TgsClientVersion>15.0.1</TgsClientVersion>
|
||||
<TgsDmapiVersion>7.0.0</TgsDmapiVersion>
|
||||
<TgsInteropVersion>5.7.0</TgsInteropVersion>
|
||||
<TgsDmapiVersion>7.0.1</TgsDmapiVersion>
|
||||
<TgsInteropVersion>5.8.0</TgsInteropVersion>
|
||||
<TgsHostWatchdogVersion>1.4.1</TgsHostWatchdogVersion>
|
||||
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
|
||||
<TgsMigratorVersion>2.0.0</TgsMigratorVersion>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// tgstation-server DMAPI
|
||||
|
||||
#define TGS_DMAPI_VERSION "7.0.0"
|
||||
#define TGS_DMAPI_VERSION "7.0.1"
|
||||
|
||||
// All functions and datums outside this document are subject to change with any version and should not be relied on.
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
"5.7.0"
|
||||
"5.8.0"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
var/json = CreateBridgeData(command, data, TRUE)
|
||||
var/encoded_json = url_encode(json)
|
||||
|
||||
var/api_prefix = interop_version.minor >= 7 ? "api/" : ""
|
||||
var/api_prefix = interop_version.minor >= 8 ? "api/" : ""
|
||||
|
||||
var/url = "http://127.0.0.1:[server_port]/[api_prefix]Bridge?[DMAPI5_BRIDGE_DATA]=[encoded_json]"
|
||||
return url
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace Tgstation.Server.Host.Service
|
||||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
ArgumentNullException.ThrowIfNull(args);
|
||||
|
||||
logger.LogDebug("Starting service lifetime as user: {username}", Environment.UserName);
|
||||
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
watchdogTask = RunWatchdog(
|
||||
stopService,
|
||||
|
||||
@@ -116,11 +116,23 @@ namespace Tgstation.Server.Host.Components.Engine
|
||||
var byondDir = PathToUserFolder;
|
||||
|
||||
Logger.LogDebug("Cleaning BYOND cache...");
|
||||
var cacheCleanTask = IOManager.DeleteDirectory(
|
||||
IOManager.ConcatPath(
|
||||
byondDir,
|
||||
CacheDirectoryName),
|
||||
cancellationToken);
|
||||
async Task CleanDirectorySafe()
|
||||
{
|
||||
try
|
||||
{
|
||||
await IOManager.DeleteDirectory(
|
||||
IOManager.ConcatPath(
|
||||
byondDir,
|
||||
CacheDirectoryName),
|
||||
cancellationToken);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning(ex, "Failed to clean BYOND cache!");
|
||||
}
|
||||
}
|
||||
|
||||
var cacheCleanTask = CleanDirectorySafe();
|
||||
|
||||
// Create local cfg directory in case it doesn't exist
|
||||
var localCfgDirectory = IOManager.ConcatPath(
|
||||
|
||||
@@ -108,9 +108,13 @@ namespace Tgstation.Server.Host.Components.Engine
|
||||
generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
|
||||
sessionConfiguration = sessionConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(sessionConfigurationOptions));
|
||||
|
||||
var documentsDirectory = Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.MyDocuments,
|
||||
Environment.SpecialFolderOption.DoNotVerify);
|
||||
var useServiceSpecialTactics = Environment.Is64BitProcess && Environment.UserName == $"{Environment.MachineName}$";
|
||||
|
||||
var documentsDirectory = useServiceSpecialTactics
|
||||
? Environment.ExpandEnvironmentVariables("%SystemRoot%\\SysWOW64\\config\\systemprofile\\Documents")
|
||||
: Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.MyDocuments,
|
||||
Environment.SpecialFolderOption.DoNotVerify);
|
||||
|
||||
PathToUserFolder = IOManager.ResolvePath(
|
||||
IOManager.ConcatPath(documentsDirectory, "BYOND"));
|
||||
|
||||
@@ -658,6 +658,8 @@ namespace Tgstation.Server.Host.Components
|
||||
/// </summary>
|
||||
void CheckSystemCompatibility()
|
||||
{
|
||||
logger.LogDebug("Running as user: {username}", Environment.UserName);
|
||||
|
||||
generalConfiguration.CheckCompatibility(logger);
|
||||
|
||||
using (var systemIdentity = systemIdentityFactory.GetCurrent())
|
||||
|
||||
@@ -46,8 +46,17 @@ namespace Tgstation.Server.Host.IO
|
||||
return;
|
||||
}
|
||||
|
||||
List<Exception>? exceptions = null;
|
||||
foreach (var subDir in dir.EnumerateDirectories())
|
||||
NormalizeAndDelete(subDir, cancellationToken);
|
||||
try
|
||||
{
|
||||
NormalizeAndDelete(subDir, cancellationToken);
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
exceptions ??= new List<Exception>();
|
||||
exceptions.AddRange(ex.InnerExceptions);
|
||||
}
|
||||
|
||||
foreach (var file in dir.EnumerateFiles())
|
||||
{
|
||||
@@ -57,14 +66,26 @@ namespace Tgstation.Server.Host.IO
|
||||
file.Attributes = FileAttributes.Normal;
|
||||
file.Delete();
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch (Exception ex)
|
||||
{
|
||||
// has happened before with .dyn.rsc.lk
|
||||
exceptions ??= new List<Exception>();
|
||||
exceptions.Add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
dir.Delete(true);
|
||||
try
|
||||
{
|
||||
dir.Delete(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
exceptions ??= new List<Exception>();
|
||||
exceptions.Add(ex);
|
||||
}
|
||||
|
||||
if (exceptions != null)
|
||||
throw new AggregateException(exceptions);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user