Fix unix socket naming

Former-commit-id: 3d50530c74
This commit is contained in:
Malte Rosenbjerg 2020-10-24 22:17:33 +02:00
parent 4624378d0e
commit fee7d6f450

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