Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error on engine modpack load #1574

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions doc/media/openage/modpack_definition_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ The following parameters have to be specified.

`[info]` contains general information about the modpack.

| Parameter | Data Type | Optional | Description |
| ------------------ | ------------- | -------- | ------------------------------------------------------------------------ |
| `packagename` | String | No | Name of the modpack. |
| `version` | String | No | Internal version number. Must have [semver](https://semver.org/) format. |
| `versionstr` | String | Yes | Human-readable version string. |
| `repo` | String | Yes | Name of the repo where the package is hosted. |
| `alias` | String | Yes | Alias of the modpack. Aliases can be used for replacing other modpacks. |
| `title` | String | Yes | Title used in UI. |
| `description` | String | Yes | Path to a file with a short description (max 500 chars). |
| `long_description` | String | Yes | Path to a file with a detailed description. |
| `url` | String | Yes | Link to the modpack's website. |
| `license` | Array[String] | Yes | License(s) of the modpack. |

| Parameter | Data Type | Optional | Description |
| ------------------ | ------------- | -------- | ----------------------------------------------------------------------- |
| `packagename` | String | No | Name of the modpack. |
| `version`\* | String | No | The modpack's internal version number. Must use [semver] format. |
| `versionstr`\* | String | Yes | Human-readable version string. |
| `repo` | String | Yes | Name of the repo where the package is hosted. |
| `alias` | String | Yes | Alias of the modpack. Aliases can be used for replacing other modpacks. |
| `title` | String | Yes | Title used in UI. |
| `description` | String | Yes | Path to a file with a short description (max 500 chars). |
| `long_description` | String | Yes | Path to a file with a detailed description. |
| `url` | String | Yes | Link to the modpack's website. |
| `license` | Array[String] | Yes | License(s) of the modpack. |

[semver]: https://semver.org/

\* `version` is used by the engine to determine the most recent version of a modpack. Therefore, it should be bumped when something in the modpack changes (e.g. whenever a new version gets published). `versionstr` is what is displayed to the user and can contain any string, so it can be used to represent any sensible version format.

## [assets] Section

Expand Down
11 changes: 9 additions & 2 deletions libopenage/gamestate/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,26 @@ void Game::load_data(const std::shared_ptr<assets::ModManager> &mod_manager) {
for (const auto &include : includes) {
// handle wildcards
auto parts = util::split(include, '/');
log::log(INFO << "parts: " << parts.size());
auto last_part = parts.back();
log::log(INFO << "last_part: " << last_part);
bool recursive = false;
auto search = include;
log::log(INFO << "search before: " << search);
if (last_part == "**") {
recursive = true;
log::log(INFO << "B0 parts size: " << parts.size());
if (parts.size() == 1) {
// include = "**"
search = include.substr(0, include.size() - 2);
// start in root directory
search = "";
log::log(INFO << "B1 search: " << search);
}
else {
// include = "path/to/somewhere/**"
// remove the slash '/' too
// remove the wildcard '**' and the slash '/'
search = include.substr(0, include.size() - 3);
log::log(INFO << "B2 search: " << search);
}
}

Expand Down
2 changes: 1 addition & 1 deletion openage/convert/service/init/api_export_required.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from openage.util.fslike.union import UnionPath


CURRENT_API_VERSION = "0.4.0"
CURRENT_API_VERSION = "0.5.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should import the global version id here, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was more of a test because I thought the API modpack might have been wrongly generated and caused the error in #1569 . But this was probably not the issue.

I don't think the modpack version should be bumped with every engine release btw. but maybe if there's a new version of the engine modpack, it should have the same version no as the current engine version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i might close this PR and think of something else to fix the issue



def api_export_required(asset_dir: UnionPath) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions openage/convert/tool/api_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def main(args, error):
del error # unused

path = Union().root
path.mount(Directory(args.dir))
path.mount(Directory(args.dir).root)

export_api(path)

Expand Down Expand Up @@ -76,7 +76,7 @@ def create_modpack() -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("engine", "0.4.0", repo="openage")
mod_def.set_info("engine", "0.5.1", versionstr="0.4.0", repo="openage")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well. should be a single source of truth?


mod_def.add_include("**")

Expand Down