Fix package description generation

--HG--
branch : feature-streamed-package
hg/feature/streamed-package
kaetemi 10 years ago
parent 85615992d7
commit 40f4eb4ad2

@ -91,6 +91,9 @@ else:
inCategories = 1 inCategories = 1
cfg.write("\t<_Categories>\n") cfg.write("\t<_Categories>\n")
for category in InstallClientData: for category in InstallClientData:
packExt = ".bnp"
if (category["StreamedPackages"]):
packExt = ".snp"
cfg.write("\t\t<_Category>\n") cfg.write("\t\t<_Category>\n")
cfg.write("\t\t\t<_Name type=\"STRING\" value=\"" + category["Name"] + "\"/>\n") cfg.write("\t\t\t<_Name type=\"STRING\" value=\"" + category["Name"] + "\"/>\n")
if category["UnpackTo"] != None: if category["UnpackTo"] != None:
@ -104,7 +107,7 @@ else:
if (len(package[1]) > 0): if (len(package[1]) > 0):
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[1][0] + "\"/>\n") cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[1][0] + "\"/>\n")
else: else:
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[0] + ".bnp\"/>\n") cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[0] + packExt + "\"/>\n")
for ref in category["Refs"]: for ref in category["Refs"]:
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + ref + "_.ref\"/>\n") cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + ref + "_.ref\"/>\n")
cfg.write("\t\t</_Category>\n") cfg.write("\t\t</_Category>\n")

@ -1176,35 +1176,13 @@ void CPatchManager::readDescFile(sint32 nVersion)
std::string unpackTo = category.getUnpackTo(); std::string unpackTo = category.getUnpackTo();
if (unpackTo == "0") if (unpackTo.substr(0, 2) == "./")
{
nlwarning("BUG: unpackTo == '0'");
unpackTo = ClientRootPath;
category.setUnpackTo(unpackTo);
}
else if (unpackTo.substr(0, 2) == "./")
{ {
unpackTo = ClientRootPath + unpackTo.substr(2); unpackTo = ClientRootPath + unpackTo.substr(2);
category.setUnpackTo(unpackTo); category.setUnpackTo(unpackTo);
} }
} }
} }
else
{
for (cat = 0; cat < DescFile.getCategories().categoryCount(); ++cat)
{
CBNPCategory &category = const_cast<CBNPCategory &>(DescFile.getCategories().getCategory(cat));
std::string unpackTo = category.getUnpackTo();
if (unpackTo == "0")
{
nlwarning("BUG: unpackTo == '0'");
unpackTo = "./";
category.setUnpackTo(unpackTo);
}
}
}
// tmp for debug : flag some categories as 'Mainland' // tmp for debug : flag some categories as 'Mainland'
for (cat = 0; cat < DescFile.getCategories().categoryCount(); ++cat) for (cat = 0; cat < DescFile.getCategories().categoryCount(); ++cat)

Loading…
Cancel
Save