Fix using "Default"

This commit is contained in:
Matt Nadareski
2016-04-13 00:44:55 -07:00
parent 0a85a477bb
commit 2d2ae31814

View File

@@ -174,10 +174,23 @@ namespace SabreTools
// the possibiliites for different ways to generate a DAT from multiple things
// Double check to see what it needs to be named
string[] splitPath = _basePath.Split(Path.DirectorySeparatorChar);
_name = (_name == "" ? (inputs.Count > 1 ? Environment.CurrentDirectory.Split(Path.DirectorySeparatorChar).Last() :
(_basePath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? splitPath[splitPath.Length - 2] : splitPath.Last())) : _name);
_name = (_name == "" ? "Default " : _name);
if (_name == "")
{
if (inputs.Count > 1)
{
_name = Environment.CurrentDirectory.Split(Path.DirectorySeparatorChar).Last();
Console.WriteLine(_name);
}
else
{
if (_basePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
_basePath = _basePath.Substring(0, _basePath.Length - 1);
}
_name = _basePath.Split(Path.DirectorySeparatorChar).Last();
}
}
_name = (_name == "" ? "Default" : _name);
_desc = (_desc == "" ? _name + (_noDate ? "" : " (" + _date + ")") : _desc);
// Now write it all out as a DAT
@@ -386,9 +399,14 @@ namespace SabreTools
}
}
string actualroot = (item == _basePath ? "Default" : Path.GetDirectoryName(item.Remove(0, _basePath.Length)).Split(Path.DirectorySeparatorChar)[0]);
actualroot = (actualroot == "" ? "Default" : actualroot);
string actualitem = (item == _basePath ? item : item.Remove(0, _basePath.Length).Remove(0, (actualroot != "Default" ? actualroot.Length + 1 : 0)));
if (_basePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
_basePath = _basePath.Substring(0, _basePath.Length - 1);
}
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)));
// Drag and drop is funny
if (actualitem == Path.GetFullPath(actualitem))