From 955b5c1c4da37425e3953200db69d06c734accea Mon Sep 17 00:00:00 2001 From: Wizzard Date: Tue, 23 Jan 2024 13:45:46 -0500 Subject: [PATCH] Windows support --- main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 1776983..3b3b7e6 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,19 @@ import os import requests import zipfile +import platform from pathlib import Path -hl_path = Path.home() / ".steam/steam/steamapps/common/Half-Life" +def get_hl_path(): + """Get the Half-Life installation path based on the operating system.""" + if platform.system() == "Windows": + return Path(os.getenv('ProgramFiles(x86)')) / "Steam/steamapps/common/Half-Life" + elif platform.system() == "Linux": + return Path.home() / ".steam/steam/steamapps/common/Half-Life" + else: + raise OSError("Unsupported operating system") + +hl_path = get_hl_path() spacelife_path = hl_path / "SpaceLife" version_file = hl_path / "SpaceLifeVersion.txt" mod_url = "https://deadzone.tf/SpaceLife.zip"