0.2.0-dev Download ZIP
29 lines ·852 B Raw
| 1 | using EvilEngine.Mounts; |
| 2 | |
| 3 | namespace EvilEngine.Adapters.Unreal; |
| 4 | |
| 5 | public static class MountPoints |
| 6 | { |
| 7 | public static VirtualPath? Resolve(string mountPoint, string platform = "Win64") |
| 8 | { |
| 9 | var at = new List<string> { "Engine", "Binaries", platform }; |
| 10 | foreach (var segment in mountPoint.Replace('\\', '/').Split('/', StringSplitOptions.RemoveEmptyEntries)) |
| 11 | { |
| 12 | if (segment == ".") |
| 13 | continue; |
| 14 | if (segment == "..") |
| 15 | { |
| 16 | if (at.Count == 0) |
| 17 | return null; |
| 18 | at.RemoveAt(at.Count - 1); |
| 19 | continue; |
| 20 | } |
| 21 | |
| 22 | at.Add(segment); |
| 23 | } |
| 24 | |
| 25 | if (at.Count == 0) |
| 26 | return VirtualPath.Root; |
| 27 | return VirtualPath.TryParse(string.Join('/', at), out var path) ? path : (VirtualPath?)null; |
| 28 | } |
| 29 | } |