Only display the file name and last dir for externals

This commit is contained in:
Exter-N 2025-08-30 19:19:07 +02:00
parent b3379a9710
commit f3ec4b2e08

View file

@ -325,6 +325,18 @@ public class ResourceTreeViewer(
ImGui.SetCursorPosX(textPos); ImGui.SetCursorPosX(textPos);
ImUtf8.Text(resourceNode.ModRelativePath); ImUtf8.Text(resourceNode.ModRelativePath);
} }
else if (resourceNode.FullPath.IsRooted)
{
var path = resourceNode.FullPath.FullName;
var lastDirectorySeparator = path.LastIndexOf('\\');
var secondLastDirectorySeparator = lastDirectorySeparator > 0
? path.LastIndexOf('\\', lastDirectorySeparator - 1)
: -1;
if (secondLastDirectorySeparator >= 0)
path = $"…{path.AsSpan(secondLastDirectorySeparator)}";
ImGui.Selectable(path.AsSpan(), false, ImGuiSelectableFlags.AllowItemOverlap,
new Vector2(ImGui.GetContentRegionAvail().X, frameHeight));
}
else else
{ {
ImGui.Selectable(resourceNode.FullPath.ToPath(), false, ImGuiSelectableFlags.AllowItemOverlap, ImGui.Selectable(resourceNode.FullPath.ToPath(), false, ImGuiSelectableFlags.AllowItemOverlap,