namespace Flawless.Server.Utility; public class PathTransformer(IConfiguration config) { private readonly string _rootPath = config.GetValue("LocalStoragePath") ?? "./Storage"; public string GetLocalStoragePath() { return _rootPath; } public string GetRepositoryRootPath(Guid repositoryId) { if (repositoryId == Guid.Empty) throw new ArgumentException(nameof(repositoryId)); return Path.Combine(_rootPath, repositoryId.ToString()); } public string GetCommitManifestPath(Guid repositoryId, Guid commitId) { if (repositoryId == Guid.Empty) throw new ArgumentException(nameof(repositoryId)); if (commitId == Guid.Empty) throw new ArgumentException(nameof(commitId)); return Path.Combine(_rootPath, repositoryId.ToString(), "Manifests", commitId.ToString()); } public string GetDepotPath(Guid repositoryId, Guid depotId) { if (repositoryId == Guid.Empty) throw new ArgumentException(nameof(repositoryId)); if (depotId == Guid.Empty) throw new ArgumentException(nameof(depotId)); return Path.Combine(_rootPath, repositoryId.ToString(), "Depots", depotId.ToString()); } }