From 4629ebb3f716cbb3ccc3596e08e3aa7bf8795835 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 13 Apr 2016 12:14:14 -0700 Subject: [PATCH] Always use the full path --- DATFromDir/DATFromDir.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DATFromDir/DATFromDir.cs b/DATFromDir/DATFromDir.cs index 1ecfaa39..718064bb 100644 --- a/DATFromDir/DATFromDir.cs +++ b/DATFromDir/DATFromDir.cs @@ -137,7 +137,8 @@ namespace SabreTools { // Set local paths and vars _tempDir = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "temp" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.DirectorySeparatorChar; - _basePath = (File.Exists(path) ? path : path + Path.DirectorySeparatorChar); + _basePath = (File.Exists(path) ? path : path + Path.DirectorySeparatorChar); + _basePath = Path.GetFullPath(_basePath); // This is where the main loop would go if (File.Exists(_basePath)) @@ -405,8 +406,8 @@ namespace SabreTools } string actualroot = (item == _basePath ? item.Split(Path.DirectorySeparatorChar).Last() : item.Remove(0, _basePath.Length).Split(Path.DirectorySeparatorChar)[0]); - actualroot = (actualroot == "" ? _basePath : actualroot); - string actualitem = (item == _basePath ? item : item.Remove(0, _basePath.Length).Remove(0, (actualroot != "Default" ? actualroot.Length : 0))); + actualroot = (actualroot == "" ? _basePath.Split(Path.DirectorySeparatorChar).Last() : actualroot); + string actualitem = (item == _basePath ? item : item.Remove(0, _basePath.Length + 1)); //.Remove(0, actualroot.Length) // Drag and drop is funny if (actualitem == Path.GetFullPath(actualitem))