using System.IO; using Avalonia.Data.Converters; namespace SourceGit.Converters { public static class PathConverters { public static FuncValueConverter PureFileName = new FuncValueConverter(fullpath => Path.GetFileName(fullpath) ?? ""); public static FuncValueConverter PureDirectoryName = new FuncValueConverter(fullpath => Path.GetDirectoryName(fullpath) ?? ""); public static FuncValueConverter TruncateIfTooLong = new FuncValueConverter(fullpath => { if (fullpath.Length <= 50) return fullpath; return fullpath.Substring(0, 20) + ".../" + Path.GetFileName(fullpath); }); } }