Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
HagenSR committed Feb 20, 2021
2 parents 1d8b8ca + 1ee8da5 commit 74653fd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion wrapper/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
print("You're a linux man I see.")
subprocess.call(["./visualizer.x86_64"])
elif plat == "darwin":
print("Literally just straight up fuck you man")
print("We don't currently have visualizer support for Mac, we apologize. Give us a poke and we'll see what can do.")

# Attempt to update the game
elif action in ['update', 'u']:
Expand Down
3 changes: 0 additions & 3 deletions wrapper/my_token_example.py

This file was deleted.

36 changes: 31 additions & 5 deletions wrapper/updater.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import base64 as numpy
import math
import os
Expand All @@ -20,6 +21,15 @@ def update():
# check version number
current_version = v

# check operating system
plat = sys.platform
vis_os = 1
if plat == "win32":
vis_os = 1
elif plat == "linux":
vis_os = 2
else: vis_os = 1

# check latest release version
try:
auth = HTTPBasicAuth(my_token.username, my_token.token)
Expand All @@ -31,6 +41,7 @@ def update():
json = payload.json()
remote_version = json["tag_name"]
asset_id = json["assets"][0]["id"]
vis_id = json["assets"][vis_os]["id"]
else:
print("There was an issue attempting to update: Bad Request: \"{0}\"".format(payload.content))
exit()
Expand Down Expand Up @@ -58,16 +69,31 @@ def update():
if not os.path.exists("br_updates"):
os.makedirs("br_updates")

remote_url = "https://api.github.com/repos/PixPanz/byte_le_royale_2021/releases/assets/{0}".format(asset_id)
local_file = "br_updates/v{0}.pyz".format(remote_version)
remote_launcher_url = "https://api.github.com/repos/PixPanz/byte_le_royale_2021/releases/assets/{0}".format(asset_id)
local_launcher_file = "br_updates/v{0}.pyz".format(remote_version)

remote_visualizer_url = "https://api.github.com/repos/PixPanz/byte_le_royale_2021/releases/assets/{0}".format(vis_id)
local_visualizer_file = "br_updates/visualizer"

if not download_file(local_file, remote_url, auth):
print("Update failed, please try again later.")
if not download_file(local_launcher_file, remote_launcher_url, auth):
print("Launcher update failed, please try again later.")
exit()

if not download_file(local_visualizer_file, remote_visualizer_url, auth):
print("Visualizer update failed, please try again later.")
exit()

# update
old_file = "launcher.pyz"
print("Replacing {0} with updated launcher.".format(old_file))
shutil.copyfile(local_file, old_file)
shutil.copyfile(local_launcher_file, old_file)

if vis_os == 1: old_file = "visualizer.exe"
elif vis_os == 2: old_file = "visualizer.x86_64"
else: old_file = "visualizer.exe"
print("Replacing {0} with updated visualizer.".format(old_file))
shutil.copyfile(local_visualizer_file, old_file)

shutil.rmtree('br_updates')

print("Update complete!")
Expand Down

0 comments on commit 74653fd

Please sign in to comment.