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

Linux savegame path assumes default steam library path #13

Closed
Findus23 opened this issue Feb 27, 2022 · 8 comments
Closed

Linux savegame path assumes default steam library path #13

Findus23 opened this issue Feb 27, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@Findus23
Copy link

Findus23 commented Feb 27, 2022

Hi and thanks for this amazing tool.

I just noticed an issue and thought I'd report it.

On Linux helphaistos looks here for the savegames to patch them:

Platform.LINUX: [ # Proton wrapper save file path
os.path.expanduser(r'~/.steam/steam/steamapps/compatdata/1145360/pfx/drive_c/users/steamuser/Documents/Saved Games/Hades'),
],

The issue is, that when using Proton steam stores the "Windows Data" (so the compatdata folder) not in the default steam library, but in the one of the game.
So for me this path is /media/path/to/my/SteamLibrary/steamapps/compatdata/1145360/pfx/drive_c/users/steamuser/Documents/Saved Games/Hades. Maybe a argument similar to --hades-dir could be used to specify the path (or alternatively use the path relative to the current path as we are already in /media/path/to/my/SteamLibrary/steamapps/common/Hades.

Also I am not entirely sure if --hades-dir works correctly or I am just doing something wrong, but I solved the issue of having to be inside the hades dir and the repostory dir (for python -m to work) by creating symlinks to all hephaistos subdirectories in the hades directory.

Apart from this the patch seems to be working perfectly.

@nbusseneau
Copy link
Owner

Ah thanks, this was a wrong assumption on my part when reading this explanation page, but re-reading it again it does specify that as well:

Most games store saves and settings in "My Documents" folder.

Folders can can be found in <steam library folder>/steamapps/compatdata/<steamid of software>/pfx/drive_c/users/steamuser/My Documents/ (and so forth)

Using a relative path sounds like the best option to me.

@nbusseneau nbusseneau self-assigned this Feb 27, 2022
@nbusseneau nbusseneau added the bug Something isn't working label Feb 27, 2022
@nbusseneau
Copy link
Owner

It does look like --hades-dir is broken yea. Will also fix that.

@nbusseneau
Copy link
Owner

I think this should be fixed by 69ef318 and 5dc2e5b. Here's an early build so that you can confirm on your end ahead of a release:

You should now be able to store Hephaistos anywhere you like and use --hades-dir to point to the Hades directory (e.g. with python -m hephaistos --hades-dir foo if using the Python version).

@Findus23
Copy link
Author

Hi,
The --hades-dir issue seems to be solved (I ran it from another directory successfully) and the solution for the relative path is also looking good.

But I think there is a small bug in it:

Traceback (most recent call last):
  File "/home/lukas/git/hephaistos/hephaistos/cli.py", line 97, in __start
    args.dispatch(**vars(args))
  File "/home/lukas/git/hephaistos/hephaistos/cli.py", line 290, in handler
    self.handler(width, height, scaling, hud, custom_resolution, force=True)
  File "/home/lukas/git/hephaistos/hephaistos/cli.py", line 282, in handler
    patchers.patch_profile_sjsons()
  File "/home/lukas/git/hephaistos/hephaistos/patchers.py", line 746, in patch_profile_sjsons
    profile_sjsons = helpers.try_get_profile_sjson_files()
  File "/home/lukas/git/hephaistos/hephaistos/helpers.py", line 159, in try_get_profile_sjson_files
    TRY_SAVE[Platform.LINUX] = Path(config.hades_dir).joinpath(TRY_SAVE[Platform.LINUX])
  File "/usr/lib/python3.9/pathlib.py", line 972, in joinpath
    return self._make_child(args)
  File "/usr/lib/python3.9/pathlib.py", line 737, in _make_child
    drv, root, parts = self._parse_args(args)
  File "/usr/lib/python3.9/pathlib.py", line 691, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not list

TRY_SAVE[Platform.LINUX] is a list of paths, but is used as if it was a single path

Platform.LINUX: [ # Proton wrapper save file path is relative to Hades dir
# e.g. if Hades dir => /path/to/SteamLibrary/steamapps/common/Hades
# then save dir => /path/to/SteamLibrary/steamapps/compatdata/1145360/pfx/drive_c/users/steamuser/Documents/Saved Games/Hades
r'../../compatdata/1145360/pfx/drive_c/users/steamuser/Documents/Saved Games/Hades',
],

elif config.platform == Platform.LINUX:
TRY_SAVE[Platform.LINUX] = Path(config.hades_dir).joinpath(TRY_SAVE[Platform.LINUX])

@Findus23
Copy link
Author

With this patch it works now perfectly fine for me (the str feels redundant with the next line, but keeps the types the same):

diff --git a/hephaistos/helpers.py b/hephaistos/helpers.py
index a9a252f..ae56feb 100644
--- a/hephaistos/helpers.py
+++ b/hephaistos/helpers.py
@@ -156,7 +156,7 @@ def try_get_profile_sjson_files() -> list[Path]:
             LOGGER.debug(e, exc_info=True)
     # If on Linux, compute save directory relative to Hades dir
     elif config.platform == Platform.LINUX:
-        TRY_SAVE[Platform.LINUX] = Path(config.hades_dir).joinpath(TRY_SAVE[Platform.LINUX])
+        TRY_SAVE[Platform.LINUX][0] = str(Path(config.hades_dir).joinpath(TRY_SAVE[Platform.LINUX][0]))
     save_dirs = [Path(item) for item in TRY_SAVE[config.platform]]
     for save_dir in save_dirs:
         if save_dir.exists():

@nbusseneau
Copy link
Owner

Right, I forgot I used lists specifically because Windows might have multiple locations 🤦🏻 Fixed in d38307a and refactored whole mechanism in 1dd3b6d.

New test build:

@Findus23
Copy link
Author

Indeed with 1dd3b6d it now also works directly.

Thanks for everything!

@nbusseneau
Copy link
Owner

Thanks for testing. Released in v1.6.3 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants