mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-14 02:27:21 -07:00
.o2r
support (#3955)
This commit is contained in:
parent
bcbe4cb1c3
commit
ebde648c59
8 changed files with 65 additions and 26 deletions
|
@ -265,7 +265,10 @@ OTRGlobals::OTRGlobals() {
|
|||
if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) {
|
||||
if (std::filesystem::is_directory(patchesPath)) {
|
||||
for (const auto& p : std::filesystem::recursive_directory_iterator(patchesPath, std::filesystem::directory_options::follow_directory_symlink)) {
|
||||
if (StringHelper::IEquals(p.path().extension().string(), ".otr")) {
|
||||
if (StringHelper::IEquals(p.path().extension().string(), ".otr") ||
|
||||
StringHelper::IEquals(p.path().extension().string(), ".mpq") ||
|
||||
StringHelper::IEquals(p.path().extension().string(), ".o2r") ||
|
||||
StringHelper::IEquals(p.path().extension().string(), ".zip")) {
|
||||
patchOTRs.push_back(p.path().generic_string());
|
||||
}
|
||||
}
|
||||
|
@ -866,7 +869,7 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) {
|
|||
|
||||
// Use a temporary archive instance to load the otr and read the version file
|
||||
auto archive = LUS::OtrArchive(otrPath);
|
||||
if (archive.LoadRaw()) {
|
||||
if (archive.Open()) {
|
||||
auto t = archive.LoadFileRaw("portVersion");
|
||||
if (t != nullptr && t->IsLoaded) {
|
||||
auto stream = std::make_shared<LUS::MemoryStream>(t->Buffer->data(), t->Buffer->size());
|
||||
|
@ -877,7 +880,7 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) {
|
|||
version.minor = reader->ReadUInt16();
|
||||
version.patch = reader->ReadUInt16();
|
||||
}
|
||||
archive.UnloadRaw();
|
||||
archive.Close();
|
||||
}
|
||||
|
||||
return version;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue