FFMpegCore/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs
Konstantin 2fcf389aba Fix pipe path for unix.
Replace fixed '/tmp' with Path.GetTempPath().

Former-commit-id: 4ecf05ec79
2020-08-21 20:10:57 +09:00

20 lines
679 B
C#

using System;
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();
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
}
}
}