FFMpegCore/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs
Ibrahim Islam d2691b6f1f fixes typo
Former-commit-id: fc988b3bbe
2020-10-20 06:53:24 +07:00

21 lines
726 B
C#

using System;
using System.IO;
using System.Runtime.InteropServices;
namespace FFMpegCore.Pipes
{
static class PipeHelpers
{
static readonly string PipePrefix = Path.Combine(Path.GetTempPath(), "CoreFxPipe_");
public static string GetUnqiuePipeName() => $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 5)}";
public static string GetPipePath(string pipeName)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return $@"\\.\pipe\{pipeName}";
else
return $"unix:{PipePrefix}{pipeName}"; // dotnet uses unix sockets on unix, for more see https://github.com/dotnet/runtime/issues/24390
}
}
}