<PackageReference Include="Relativity.Server.Transfer.SDK" Version="24000.0.1" />

LinuxCanonicalFormConverter

using System; using System.Diagnostics; using System.IO; namespace Relativity.DataTransfer.Nodes.PathConversion { internal sealed class LinuxCanonicalFormConverter : ICanonicalFormConverter { private const int MaxTimeout = 5000; public string Convert(string path) { return string.IsNullOrWhiteSpace(path) ? path : (HasHome(path) ? ResolvePathByShellExecution(path) : ResolvePathByFramework(path)); } private static bool HasHome(string path) { return path.StartsWith("~") || path.Contains("$HOME"); } private static string ResolvePathByShellExecution(string path) { string cmd = "echo " + path; string str = EscapedQuotas(cmd); try { using (Process process = new Process { StartInfo = new ProcessStartInfo { FileName = "/bin/bash", Arguments = "-c \"" + str + "\"", RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true } }) { process.Start(); string text = process.StandardOutput.ReadToEnd(); process.WaitForExit(5000); return text.TrimEnd(Array.Empty<char>()); } } catch { throw new PathConversionPipelineException("Unable to resolve path '" + path + "' using shell command."); } } private static string EscapedQuotas(string cmd) { return cmd.Replace("\"", "\\\""); } private static string ResolvePathByFramework(string path) { return new FileInfo(path).FullName; } } }