port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
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);
}
}