33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.IO;
|
|
using Microsoft.Extensions.PlatformAbstractions;
|
|
|
|
namespace Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest
|
|
{
|
|
public class Helpers
|
|
{
|
|
public static string GetApplicationPath(string projectName)
|
|
{
|
|
var applicationBasePath = PlatformServices.Default.Application.ApplicationBasePath;
|
|
|
|
var directoryInfo = new DirectoryInfo(applicationBasePath);
|
|
do
|
|
{
|
|
var solutionFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, "SignalR.sln"));
|
|
if (solutionFileInfo.Exists)
|
|
{
|
|
return Path.GetFullPath(Path.Combine(directoryInfo.FullName, "test", projectName));
|
|
}
|
|
|
|
directoryInfo = directoryInfo.Parent;
|
|
}
|
|
while (directoryInfo.Parent != null);
|
|
|
|
throw new Exception($"Solution root could not be found using {applicationBasePath}");
|
|
}
|
|
}
|
|
}
|