dotnet-installer/test/dotnet.Tests/TestCommandExtensions.cs

24 lines
921 B
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright (c) .NET Foundation and contributors. All rights reserved. 
// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
using System.Runtime.InteropServices;
using Microsoft.DotNet.Tools.Test.Utilities;
namespace Microsoft.DotNet.Tests
{
public static class TestCommandExtensions
{
public static TestCommand WithUserProfileRoot(this TestCommand testCommand, string path)
{
var userProfileEnvironmentVariableName = GetUserProfileEnvironmentVariableName();
return testCommand.WithEnvironmentVariable(userProfileEnvironmentVariableName, path);
}
private static string GetUserProfileEnvironmentVariableName()
{
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? "LocalAppData"
: "HOME";
}
}
}