From 62b4c730919e4de311a621ba3b933845c3a3d4a9 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 3 Nov 2016 22:17:27 -0700 Subject: [PATCH] [DatFile] Make sure we do the right thing with splits and paths for diffs --- SabreTools.Helper/Dats/DatFile.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SabreTools.Helper/Dats/DatFile.cs b/SabreTools.Helper/Dats/DatFile.cs index 6f6d348e..b479b1e9 100644 --- a/SabreTools.Helper/Dats/DatFile.cs +++ b/SabreTools.Helper/Dats/DatFile.cs @@ -1081,7 +1081,10 @@ namespace SabreTools.Helper.Dats for (int j = 0; j < inputs.Count; j++) { // If we have an output directory set, replace the path - string path = outDir + (Path.GetDirectoryName(inputs[j].Split('¬')[0]).Remove(0, inputs[j].Split('¬')[1].Length)); + string[] split = inputs[j].Split('¬'); + string path = outDir + (split[0] == split[1] + ? Path.GetFileName(split[0]) + : (Path.GetDirectoryName(split[0]).Remove(0, split[1].Length))); // If we have more than 0 roms, output if (outDats[j].Files.Count > 0) @@ -1188,7 +1191,10 @@ namespace SabreTools.Helper.Dats } else if (!String.IsNullOrEmpty(outDir)) { - path = outDir + (Path.GetDirectoryName(inputs[j].Split('¬')[0]).Remove(0, inputs[j].Split('¬')[1].Length)); + string[] split = inputs[j].Split('¬'); + path = outDir + (split[0] == split[1] + ? Path.GetFileName(split[0]) + : (Path.GetDirectoryName(split[0]).Remove(0, split[1].Length)));; } // If we have more than 0 roms, output