From 95afc206dc38f53077f40e9bba7b362216b24569 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 23 Apr 2023 20:47:41 -0400 Subject: [PATCH] Check if root path ended with directory separator --- SabreTools.DatTools/DatFileTool.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SabreTools.DatTools/DatFileTool.cs b/SabreTools.DatTools/DatFileTool.cs index 9b9615ab..90768a5e 100644 --- a/SabreTools.DatTools/DatFileTool.cs +++ b/SabreTools.DatTools/DatFileTool.cs @@ -44,8 +44,12 @@ namespace SabreTools.DatTools string filename = inputs[newItem.Source.Index].CurrentPath; string rootpath = inputs[newItem.Source.Index].ParentPath; - if (!string.IsNullOrWhiteSpace(rootpath)) + if (!string.IsNullOrWhiteSpace(rootpath) + && !rootpath.EndsWith(Path.DirectorySeparatorChar) + && !rootpath.EndsWith(Path.AltDirectorySeparatorChar)) + { rootpath += Path.DirectorySeparatorChar.ToString(); + } filename = filename.Remove(0, rootpath.Length); newItem.Machine.Name = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar