Merge pull request #374 from ep1kt3t0s/short-socket-naming

Short socket names to prevent 104 char limit
This commit is contained in:
Malte Rosenbjerg 2023-01-31 22:34:49 +01:00 committed by GitHub
commit 11abaeecc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,18 +1,20 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace FFMpegCore.Pipes
{
static class PipeHelpers
{
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)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return $@"\\.\pipe\{pipeName}";
else
return $"unix:/tmp/CoreFxPipe_{pipeName}";
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return $"unix:{Path.GetTempPath()}/CoreFxPipe_{pipeName}";
return $"unix:/tmp/CoreFxPipe_{pipeName}";
}
}
}