Don't add unnecessary ".cnmt" to SwitchFs nca names

This commit is contained in:
Alex Barney 2019-08-09 20:47:21 -05:00
parent 9d813ade18
commit 614adb2a31

View file

@ -80,7 +80,7 @@ namespace LibHac
nca = new SwitchFsNca(new Nca(Keyset, storage));
nca.NcaId = Path.GetFileNameWithoutExtension(fileEntry.Name);
nca.NcaId = GetNcaFilename(fileEntry.Name, nca);
string extension = nca.Nca.Header.ContentType == ContentType.Meta ? ".cnmt.nca" : ".nca";
nca.Filename = nca.NcaId + extension;
}
@ -227,6 +227,16 @@ namespace LibHac
}
}
private string GetNcaFilename(string name, SwitchFsNca nca)
{
if (nca.Nca.Header.ContentType != ContentType.Meta || !name.EndsWith(".cnmt.nca"))
{
return Path.GetFileNameWithoutExtension(name);
}
return name.Substring(0, name.Length - ".cnmt.nca".Length);
}
private void DisposeNcas()
{
//foreach (SwitchFsNca nca in Ncas.Values)