withaspirit / FTL-MV-Wiki-Tools

Files, mods, and scripts to help edit the Wiki for FTL: Multiverse
MIT License
0 stars 0 forks source link

Linux Compatibility #18

Open penguin-glitch opened 9 months ago

penguin-glitch commented 9 months ago

This is a general issue report for the problems I've found running these tools on a linux system according to the instructions in the readme:

  1. Line 25 of wikiToolsInit.py: drive = pathlib.Path.home().drive returns a blank string on a linux system as it does not recognise unix file structure. Fix: Somewhat of a band-aid fix, but I simply added this conditional to replace the drive with the home directory. It assumes that all files are located under the home directory, which is usually true:
    drive  = pathlib.Path.home().drive
    if len(drive) == 0:
    drive = pathlib.Path.home()
  2. At various points '//' is appended to path strings. This ends up causing issues when using os.path.join, resulting in a path that looks like this: "/this/is/a/\path" on Linux. On Windows this becomes "this\is\a\path", which I assume works fine. Simply remove these ending slashes.
  3. The fix for the above issue results in several places where paths are simply added together breaking completely. This isn't great anyway, so replace these instances with os.path.join(), i.e: modmanCfgPath = f'{config[mainPaths][slipstream]}{modmanCfg}' becomes modmanCfgPath = os.path.join(f'{config[mainPaths][slipstream]}', modmanCfg)

This is just the first command - python wikiToolsCLI.py --init. Running the second results in every stage giving an invalid syntax java error, and I don't quite understand what these java commands are doing - the first one seems to be trying to execute java -jar modman.jar --validate Append Wiki blueprintLists.zip. I'm not sure if the last part (Append Wiki blueprintLists.zip) is intentional or if that actually works as java command syntax. Haven't tried to run the third.

withaspirit commented 9 months ago

Hi @penguin-glitch, thanks for reaching out.

I've opened a PR addressing these issues: #19

  1. Added.

  2. I'm assuming you mean my use of '\\' for file pathing in the code. I've removed some of them in the PR. Let me know if there's anything else that needs to be changed. For reference, a lot of the paths are saved to the file wikiTools.ini.

I didn't write the script with Linux compatibility in mind, so that's probably causing a lot of issues.

Also, if you know if there is a default folder where Steam is usually located on Linux distros, you providing it could allow me to add it to the wikiToolsInit.py script to speed up the part of the script that locates modman.jar. Would avoid scanning the entire disk.

penguin-glitch commented 9 months ago

Thanks for replying.

Steam's FTL data on linux is usually located at ~/.steam/steam/steamapps/common/FTL Faster Than Light. This isnt always the case, like if steam is installed through flatpak it goes... somewhere else. People generally avoid using flatpak anyway so it's not a huge priority to work around.

This isnt guaranteed to be where modman.jar is, the official install guide for Linux tells users to extract slipstream into their downloads folder (personally I keep it in Documents), but it might speed things up in some cases.