Windows support

This commit is contained in:
Wizzard 2024-01-23 13:45:46 -05:00
parent 9e59d2a35e
commit 955b5c1c4d
1 changed files with 11 additions and 1 deletions

12
main.py
View File

@ -1,9 +1,19 @@
import os import os
import requests import requests
import zipfile import zipfile
import platform
from pathlib import Path 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" spacelife_path = hl_path / "SpaceLife"
version_file = hl_path / "SpaceLifeVersion.txt" version_file = hl_path / "SpaceLifeVersion.txt"
mod_url = "https://deadzone.tf/SpaceLife.zip" mod_url = "https://deadzone.tf/SpaceLife.zip"