Skip to content

Commit

Permalink
Add heroic launcher support for epic games
Browse files Browse the repository at this point in the history
  • Loading branch information
ZashIn committed Jan 5, 2025
1 parent 4ae392f commit a280e5d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions epic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def find_epic_games() -> Iterable[tuple[str, Path]]:
)


def find_legendary_games() -> Iterable[tuple[str, Path]]:
def find_legendary_games(config_path: str | None = None) -> Iterable[tuple[str, Path]]:
# Based on legendary source:
# https://github.com/derrod/legendary/blob/master/legendary/lfs/lgndry.py
if config_path := os.environ.get("XDG_CONFIG_HOME"):
if config_path := config_path or os.environ.get("XDG_CONFIG_HOME"):
legendary_config_path = Path(config_path, "legendary")
else:
legendary_config_path = Path("~/.config/legendary").expanduser()
Expand All @@ -61,8 +61,14 @@ def find_legendary_games() -> Iterable[tuple[str, Path]]:
)


def find_heroic_games():
return find_legendary_games(os.path.expandvars(r"%AppData%\heroic\legendaryConfig"))


def find_games() -> dict[str, Path]:
return dict(itertools.chain(find_epic_games(), find_legendary_games()))
return dict(
itertools.chain(find_epic_games(), find_legendary_games(), find_heroic_games())
)


if __name__ == "__main__":
Expand Down

0 comments on commit a280e5d

Please sign in to comment.