using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Intromat.Helpers { public static class IOHelper { public static string GetRelativePath(string basePath, string fullPath) { if (string.IsNullOrEmpty(basePath)) return fullPath ?? ""; if (string.IsNullOrEmpty(fullPath)) return ""; if (basePath.Last() != '\\') basePath += "\\"; var builder = new StringBuilder(4096); _ = PathRelativePathTo(builder, basePath, 0, fullPath, 0); return builder.ToString()[2..]; } [DllImport("shlwapi.dll", EntryPoint = "PathRelativePathTo", CharSet = CharSet.Unicode)] private static extern bool PathRelativePathTo(StringBuilder lpszDst, string from, uint attrFrom, string to, uint attrTo); } }