xforce/anno1800-mod-loader

Include Directive breaks due to filepath including the current file

Closed this issue · 2 comments

GetXmlOperationsFromFile(mod_path / file, mod_name, game_path, mod_path);

At this point, mod_path seems to be the the path to the current file rather than the mod directory.

I have an assets.xml that should reference assets_old.xml in the same directory.

<ModOps>
    <Include File="data\config\export\main\asset\assets_old.xml" />
</ModOps>

which results in the following error:

[2021-11-07 16:03:21.105] [error] [[New Horizons] Main] Failed to parse E:\SteamLibrary\steamapps\common\Anno 1800\mods\[New Horizons] Main\data\config\export\main\asset\assets.xml\data\config\export\main\asset\assets_old.xml(1, 1): File was not found

As you can see, it tries to look up the file starting at the directory of the current file the Include Directive was called from.

xmltest is also having inconsistent behavior. It uses the the working directory.

test/
  assets-cheese.xml
  assets.xml

<Include File="./assets-cheese.xml"> does work here, but only with test as the working directory - which is something I want to avoid.

Fixed in 2b4bac3