Skip to content

Commit

Permalink
Merge pull request #191 from ovosimpatico/main
Browse files Browse the repository at this point in the history
Fix for OS detection failing on some ocasions and stopping the software
  • Loading branch information
zayKenyon authored Mar 18, 2024
2 parents 074ad47 + 0350129 commit 46ad03c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
10 changes: 3 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,9 @@ def get_ip():
Logging = Logging()
log = Logging.log

# OS Logging + quit if OS unsupported
if get_os()[1] == False:
print(f"Unsupported operating system: {get_os()[0]}\n")
log(f"Unsupported operating system: {get_os()[0]}\n")
program_exit(0)
else:
log(f"Operating system: {get_os()[0]}\n")
# OS Logging
log(f"Operating system: {get_os()}\n")

try:
if len(sys.argv) > 1 and sys.argv[1] == "--config":
configure()
Expand Down
22 changes: 5 additions & 17 deletions src/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@
# This function detects the OS the user is running and if Valorant is officially supported in said platform
# returns ["operating system" (string), "Runs Valorant" (bool)]
def get_os():
system = platform.system()

if system == "Windows":
# Detects if Windows version **is not** 10 or 11
if platform.win32_ver()[0] != str(10 or 11):
return f"Windows {platform.win32_ver()[0]} {platform.win32_edition()} {platform.win32_ver()[1]}", False

# Workaround for Windows 11 being detected as Windows 10, might not be necessary in the future
# https://github.com/python/cpython/issues/89545
if int(platform.win32_ver()[1].split(".")[-1]) >= 22000:
return f"Windows 11 {platform.win32_edition()} {platform.win32_ver()[1]}", True
else:
return f"Windows 10 {platform.win32_edition()} {platform.win32_ver()[1]}", True


# Handles other Operating systems, such as Linux or Mac OS
# Handles Windows operating systems
if platform.system() == "Windows":
return f"Windows {platform.win32_ver()[0]} {platform.win32_edition()} {platform.win32_ver()[1]}"
# Handles other operating systems, such as Linux or Mac OS
else:
return "Non-Windows operating system", False
return "Non-Windows operating system"

0 comments on commit 46ad03c

Please sign in to comment.