Fix unix socket naming

This commit is contained in:
Malte Rosenbjerg 2020-10-24 22:17:33 +02:00
parent bc92e54c99
commit 3d50530c74

View file

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