diff --git a/src/Tgstation.Server.Host/Components/Configuration.cs b/src/Tgstation.Server.Host/Components/Configuration.cs
index 36e1934498..1ab7412e7d 100644
--- a/src/Tgstation.Server.Host/Components/Configuration.cs
+++ b/src/Tgstation.Server.Host/Components/Configuration.cs
@@ -83,12 +83,37 @@ namespace Tgstation.Server.Host.Components
}
///
- public Task> ListDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
+ public async Task> ListDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
{
if (String.IsNullOrEmpty(configurationRelativePath))
configurationRelativePath = ".";
- throw new NotImplementedException();
+ var path = ioManager.ResolvePath(configurationRelativePath);
+
+ List result = new List();
+
+ void ListImpl()
+ {
+ var enumerator = synchronousIOManager.GetDirectories(configurationRelativePath, cancellationToken);
+ result.AddRange(enumerator.Select(x => new ConfigurationFile
+ {
+ IsDirectory = true,
+ Path = ioManager.ConcatPath(path, x),
+ }));
+ enumerator = synchronousIOManager.GetFiles(configurationRelativePath, cancellationToken);
+ result.AddRange(enumerator.Select(x => new ConfigurationFile
+ {
+ IsDirectory = false,
+ Path = ioManager.ConcatPath(path, x),
+ }));
+ }
+
+ if (systemIdentity == null)
+ ListImpl();
+ else
+ await systemIdentity.RunImpersonated(ListImpl, cancellationToken).ConfigureAwait(false);
+
+ return result;
}
///