using System.IO;
using System.Reflection;
namespace RGB.NET.Core
{
///
/// Offers some helper-methods for file-path related things.
///
public static class PathHelper
{
#region Methods
///
/// Returns an absolute path created from an relative path relatvie to the location of the executung assembly.
///
/// The relative path to convert.
/// The absolute path.
public static string GetAbsolutePath(string relativePath)
{
string assemblyLocation = Assembly.GetEntryAssembly()?.Location;
if (assemblyLocation == null) return relativePath;
string directoryName = Path.GetDirectoryName(assemblyLocation);
return directoryName == null ? null : Path.Combine(directoryName, relativePath);
}
#endregion
}
}