| 137 | } |
| 138 | |
| 139 | bool AddonSystem::CheckVersion(const RString& prefix, const ParamEntry& addon) |
| 140 | { |
| 141 | const ParamEntry* patches = addon.FindEntry("CfgPatches"); |
| 142 | if (!patches || patches->GetEntryCount() == 0) |
| 143 | return false; |
| 144 | |
| 145 | RString strVersion = GetAppVersion(); |
| 146 | int version = VersionToInt(strVersion); |
| 147 | |
| 148 | for (int i = 0; i < patches->GetEntryCount(); i++) |
| 149 | { |
| 150 | const ParamEntry& patch = patches->GetEntry(i); |
| 151 | const ParamEntry* entry = patch.FindEntry("requiredVersion"); |
| 152 | if (entry) |
| 153 | { |
| 154 | RString required = *entry; |
| 155 | if (VersionToInt(required) > version) |
| 156 | { |
| 157 | WarningMessage("Addon '%s' requires version %s or higher", (const char*)patch.GetName(), |
| 158 | (const char*)required); |
| 159 | return false; |
| 160 | } |
| 161 | } |
| 162 | const AddonInfo& info = s_addonRegistry[patch.GetName()]; |
| 163 | if (s_addonRegistry.NotNull(info)) |
| 164 | RptF("Conflicting addon %s in '%s', previous definition in '%s'", (const char*)patch.GetName(), |
| 165 | (const char*)prefix, (const char*)info.GetPrefix()); |
| 166 | else |
| 167 | s_addonRegistry.Add(AddonInfo(patch.GetName(), prefix)); |
| 168 | } |
| 169 | |
| 170 | return true; |
| 171 | } |
| 172 | |
| 173 | bool AddonSystem::ParseAddonConfig(const RString& prefixPath) |
| 174 | { |
nothing calls this directly
no test coverage detected