Don't cut off extension

This commit is contained in:
Matt Nadareski
2016-04-06 00:53:00 -07:00
parent ca4d69cd00
commit 0f54938df3

View File

@@ -92,8 +92,14 @@ namespace SabreTools
XmlElement tempNode = (XmlElement)tempDoc.ImportNode(child, true);
// Windows max name length is 260. Taking into account the game name of "!", we can use 259 characters
tempNode.SetAttribute("name", "(" + node.Attributes["name"].Value + ")" + child.Attributes["name"].Value);
tempNode.Attributes["name"].Value = (tempNode.Attributes["name"].Value.Length > 259 ? tempNode.Attributes["name"].Value.Substring(0, 259) : tempNode.Attributes["name"].Value);
string tempname = "(" + node.Attributes["name"].Value + ")" + child.Attributes["name"].Value;
if (tempname.Length > 259)
{
string ext = Path.GetExtension(tempname);
tempname = tempname.Substring(0, 259 - ext.Length);
tempname += ext;
}
tempNode.SetAttribute("name", tempname);
outNode.AppendChild(tempNode);
}
}