change usage

This commit is contained in:
ZephyrTFA
2024-08-18 13:45:24 -04:00
parent 259fd60ddf
commit d2c9ab62fe
@@ -676,9 +676,15 @@ namespace Tgstation.Server.Host.Components
if (!systemIdentity.CanCreateSymlinks)
throw new InvalidOperationException($"The user running {Constants.CanonicalPackageName} cannot create symlinks! Please try running as an administrative user!");
if (systemIdentity is PosixSystemIdentity posixIdentity && posixIdentity.IsRoot())
if (!platformIdentifier.IsWindows && systemIdentity.IsSuperUser!.Value)
{
logger.LogWarning("TGS is being run as the root account. This is not recommended and may prevent launch in a future version.");
if (systemIdentity.IsSuperUser is not { } superUser)
{
throw new InvalidOperationException("Failed to determine if running as root.");
}
if (superUser)
logger.LogWarning("TGS is being run as the root account. This is not recommended and may prevent launch in a future version.");
}
}