Skip to content

Commit

Permalink
Merge pull request #374 from ep1kt3t0s/short-socket-naming
Browse files Browse the repository at this point in the history
Short socket names to prevent 104 char limit
  • Loading branch information
rosenbjerg authored Jan 31, 2023
2 parents 6460f3c + 75e4f6f commit 11abaee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs
Original file line number Diff line number Diff line change
@@ -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}";
}
}
}

0 comments on commit 11abaee

Please sign in to comment.