This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-nitride-cil/src/Nitride.Javascript/YarnHelper.cs
Dylan R. E. Moonfire 78054ee2a7 feat: initial release
2021-09-07 00:15:45 -05:00

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;
}
}
}