2016-04-22 19:23:26 +00:00
|
|
|
|
// 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;
|
2016-06-08 23:28:52 +00:00
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
2016-04-22 19:23:26 +00:00
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|