bvbohnen / x4-projects

Parent repo for other X4 projects, with shared code for documentation and release generation.
MIT License
36 stars 11 forks source link

[Python Pipe Server] FileNotFoundError when using MO2 Virtual Filesystem #19

Open JeffreyBytes opened 1 month ago

JeffreyBytes commented 1 month ago

When using Mod Organizer 2 to manage the mods, I get the FileNotFoundError:

Rejecting module due to error during extension id permission check:
 path: E:\Games\X4 Foundations\extensions\sn_mod_support_apis\python_time_api.txt
FileNotFoundError: [Errno 2] No such file or directory: 'E:\\Games\\X4 Foundations\\extensions\\sn_mod_support_apis\\content.xml'

I understand if you don't want to add support for MO2 instances, but I wanted to report in case there is an obvious fix. Thanks!

Vectorial1024 commented 1 month ago

content.xml is a requirement for a folder to become a mod folder, so this seem like a valid problem, and not something specific to MO2.

JeffreyBytes commented 1 month ago

The mods show up just fine in game when managed by MO2, and as you can see from the included screenshot, the content.xml is there in the virtual filesystem. Could it potentially be something with the double backslashes in the file path? I only wonder because the file path listed before it uses single backslashes.

Very odd that it works fine if I manually install the mod, and is only an issue when managed by MO2. I have to assume it is something with MO2's virtual filesystem.

image

Vectorial1024 commented 1 month ago

Ah yes, slashes and the OS... that can be annoying. Different OS have different directory slashes. This really depends on how the Python code is written (I am not a dev here), but ideally we should be using something like https://docs.python.org/3/library/pathlib.html

bvbohnen commented 1 week ago

Pathlib is used; the slash differences appear to just be inconsistencies in pathlib behavior (single slashes for printed path, but double slashes when pathlib generates the file not found error).

As for the error itself, I don't use MO2 but it sounds like their vfs implementation means the actual extension files aren't present in the x4 extensions folders in the normal file system. The pipe server is looking for files in the normal location and not finding them. I don't know if there is an easy fix, unless MO2 has a way to apply its vfs to both the game and the pipe server at the same time.

Forleyor commented 5 days ago

Just a quick note in regards to mod organizer 2, you can use Mod Support APIs + Python Pipe Server in MO2, I just tested this with Mycu's External App which makes use of the pipe server and it does work, to do this you will need to use Kezyma's Root Builder Plugin https://kezyma.github.io/?p=rootbuilder

Mod Organizer 2 by default only manages the standard mod directory in supported games hence the requirement for Root Builder to manage the pipe server being in the root directory.

Saying this though, this isn't an issue with SirNukes mods specifically.