35 lines
928 B
C#
35 lines
928 B
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace Nitride.Javascript
|
|
{
|
|
/// <summary>
|
|
/// A helper class for finding how to run or install Yarn.
|
|
/// </summary>
|
|
public static class YarnHelper
|
|
{
|
|
/// <summary>
|
|
/// Gets the name of the command to run Yarn.
|
|
/// </summary>
|
|
/// <returns>The command to run.</returns>
|
|
public static string GetYarnCommand()
|
|
{
|
|
// Figure out how to run Yarn. This is needed because Windows can't
|
|
// run the script like the shell can.
|
|
string command = "yarn";
|
|
string appData = Path.Combine(
|
|
Environment.GetFolderPath(
|
|
Environment.SpecialFolder.ApplicationData),
|
|
"npm",
|
|
"yarn.cmd");
|
|
|
|
if (File.Exists(appData))
|
|
{
|
|
command = appData;
|
|
}
|
|
|
|
return command;
|
|
}
|
|
}
|
|
}
|