De-duplicate variable definitions
This commit is contained in:
parent
aaea8a0e3f
commit
989742955b
27
Main_menu.gd
27
Main_menu.gd
@ -23,6 +23,12 @@ func _ready():
|
||||
elif OS.get_name() == "Windows":
|
||||
os_name = "windows"
|
||||
|
||||
if os_name == "windows":
|
||||
suffix = ".exe"
|
||||
else:
|
||||
suffix = ""
|
||||
|
||||
|
||||
var versions_request = HTTPRequest.new()
|
||||
add_child(versions_request)
|
||||
|
||||
@ -37,17 +43,6 @@ func _versions_request_completed(result, response_code, headers, body):
|
||||
print("Got versions!")
|
||||
|
||||
func _download_request_completed(result, response_code, headers, body):
|
||||
if OS.get_name() == "X11":
|
||||
var os_name = "linux"
|
||||
elif OS.get_name() == "Windows":
|
||||
var os_name = "windows"
|
||||
|
||||
if os_name == "windows":
|
||||
var suffix = ".exe"
|
||||
else:
|
||||
var suffix = ""
|
||||
|
||||
print("Download complete")
|
||||
var dl_file = File.new()
|
||||
dl_file.open(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64", 7)
|
||||
dl_file.store_buffer(body)
|
||||
@ -60,20 +55,14 @@ func _download_request_completed(result, response_code, headers, body):
|
||||
OS.execute("chmod", ["+x", OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"])
|
||||
|
||||
func _on_Play_button_pressed():
|
||||
var suffix = ""
|
||||
if os_name == "windows":
|
||||
suffix = ".exe"
|
||||
|
||||
print(os_name)
|
||||
|
||||
if not newest_local_version or newest_version > newest_local_version:
|
||||
var download = HTTPRequest.new()
|
||||
var url
|
||||
|
||||
add_child(download)
|
||||
|
||||
download.connect("request_completed", self, "_download_request_completed")
|
||||
|
||||
var url
|
||||
|
||||
for asset in newest_version_data.assets:
|
||||
if asset.name == "UltraFlare-"+os_name+"-x86_64"+suffix:
|
||||
url = asset.browser_download_url
|
||||
|
Loading…
Reference in New Issue
Block a user